mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 06:28:01 +02:00
[test/a8-mask] Fix memleak.
Destroy the auxiallary surfaces and contexts.
This commit is contained in:
parent
a3f071aee7
commit
af88d4d9ae
1 changed files with 8 additions and 6 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue