summaryrefslogtreecommitdiff
path: root/test/a8-mask.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-01-30 15:20:50 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2008-02-15 13:50:42 +0000
commitaf88d4d9ae66152ac885531bfc73a47eb78d1d03 (patch)
treef8c8fffaf4597d6d35aca784489ac41f558fca98 /test/a8-mask.c
parenta3f071aee707e66e637587f1e9ae327b21243a60 (diff)
downloadcairo-af88d4d9ae66152ac885531bfc73a47eb78d1d03.tar.gz
[test/a8-mask] Fix memleak.
Destroy the auxiallary surfaces and contexts.
Diffstat (limited to 'test/a8-mask.c')
-rw-r--r--test/a8-mask.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/test/a8-mask.c b/test/a8-mask.c
index 14d4f8f3f..fec2fea0d 100644
--- a/test/a8-mask.c
+++ b/test/a8-mask.c
@@ -75,7 +75,7 @@ test_surface_with_width_and_stride (int width, int stride,
cairo_test_log ("Creating surface with width %d and stride %d\n",
width, stride);
- data = malloc (stride);
+ data = xmalloc (stride);
surface = cairo_image_surface_create_for_data (data, CAIRO_FORMAT_A8,
width, 1, stride);
@@ -85,15 +85,17 @@ test_surface_with_width_and_stride (int width, int stride,
status = check_status (cairo_surface_status (surface), expected);
if (status)
- return status;
+ goto BAIL;
status = check_status (cairo_status (cr), expected);
if (status)
- return status;
+ goto BAIL;
+ BAIL:
+ cairo_destroy (cr);
+ cairo_surface_destroy (surface);
free (data);
-
- return CAIRO_TEST_SUCCESS;
+ return status;
}
static cairo_test_status_t
@@ -135,7 +137,7 @@ draw (cairo_t *cr, int dst_width, int dst_height)
stride = cairo_format_stride_for_width (CAIRO_FORMAT_A8,
MASK_WIDTH);
- mask_aligned = malloc (stride * MASK_HEIGHT);
+ mask_aligned = xmalloc (stride * MASK_HEIGHT);
src = mask;
dst = mask_aligned;