summaryrefslogtreecommitdiff
path: root/src/test-paginated-surface.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/test-paginated-surface.c')
-rw-r--r--src/test-paginated-surface.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/test-paginated-surface.c b/src/test-paginated-surface.c
index 3e9bad8c..7d341ad7 100644
--- a/src/test-paginated-surface.c
+++ b/src/test-paginated-surface.c
@@ -69,6 +69,7 @@ _cairo_test_paginated_surface_create_for_data (unsigned char *data,
{
cairo_status_t status;
cairo_surface_t *target;
+ cairo_surface_t *paginated;
test_paginated_surface_t *surface;
target = _cairo_image_surface_create_for_data_with_content (data, content,
@@ -80,6 +81,7 @@ _cairo_test_paginated_surface_create_for_data (unsigned char *data,
surface = malloc (sizeof (test_paginated_surface_t));
if (surface == NULL) {
+ cairo_surface_destroy (target);
_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
return (cairo_surface_t *) &_cairo_surface_nil;
}
@@ -89,8 +91,14 @@ _cairo_test_paginated_surface_create_for_data (unsigned char *data,
surface->target = target;
- return _cairo_paginated_surface_create (&surface->base, content, width, height,
- &test_paginated_surface_paginated_backend);
+ paginated = _cairo_paginated_surface_create (&surface->base,
+ content, width, height,
+ &test_paginated_surface_paginated_backend);
+ if (paginated->status) {
+ cairo_surface_destroy (target);
+ free (surface);
+ }
+ return paginated;
}
static cairo_status_t