diff options
author | Robin Watts <robin.watts@artifex.com> | 2014-09-02 10:09:18 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2014-09-02 10:16:38 +0100 |
commit | c5751c40523da6b84236e543bed20cfb39c564b2 (patch) | |
tree | c1b8c4f5c03b56a405f7697b0c47ef1439d4ab49 /source | |
parent | bf4c2245c59ac4e68902354eb2ccc80582863223 (diff) | |
download | mupdf-c5751c40523da6b84236e543bed20cfb39c564b2.tar.xz |
Fix memory leaks in test_device.
We were failing to drop each pixmap after testing it, and to free
the test_device structure at the end of each run.
Diffstat (limited to 'source')
-rw-r--r-- | source/fitz/test-device.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/fitz/test-device.c b/source/fitz/test-device.c index 0b37e1ad..9f575f4c 100644 --- a/source/fitz/test-device.c +++ b/source/fitz/test-device.c @@ -181,6 +181,8 @@ fz_test_fill_image(fz_device *dev, fz_image *image, const fz_matrix *ctm, float } fz_fin_cached_color_converter(&cc); } + + fz_drop_pixmap(ctx, pix); } static void @@ -191,6 +193,15 @@ fz_test_fill_image_mask(fz_device *dev, fz_image *image, const fz_matrix *ctm, fz_test_color(dev, colorspace, color); } +static void +fz_test_free(fz_device *dev) +{ + if (dev == NULL) + return; + fz_free(dev->ctx, dev->user); + dev->user = NULL; +} + fz_device * fz_new_test_device(fz_context *ctx, int *is_color, float threshold) { @@ -218,6 +229,7 @@ fz_new_test_device(fz_context *ctx, int *is_color, float threshold) dev->fill_shade = fz_test_fill_shade; dev->fill_image = fz_test_fill_image; dev->fill_image_mask = fz_test_fill_image_mask; + dev->free_user = fz_test_free; *t->is_color = 0; |