summaryrefslogtreecommitdiff
path: root/gfx
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2016-08-30 15:14:23 -0300
committerWerner Almesberger <werner@almesberger.net>2016-08-30 15:16:55 -0300
commitfefaf1bd733e241242e1f75ba04d932f17951354 (patch)
treea88cf0fb5de37b3ea0e3732a11d63a891dcbc1db /gfx
parent35f2c9c26e6d7975e4c29eaa79dd10e29f24dea4 (diff)
downloadeeshow-fefaf1bd733e241242e1f75ba04d932f17951354.tar.gz
eeshow-fefaf1bd733e241242e1f75ba04d932f17951354.tar.bz2
eeshow-fefaf1bd733e241242e1f75ba04d932f17951354.zip
fix a few memory leaks (in non-interactive mode)
We now leak less than 1 MB on valgrind --leak-check=full eeshow -N 1 neo900.pro -- png -o foo.png instead of about 3.5 MB. The plan is as follows: - fix memory leaks in simple operations in on-interactive mode, - suppress what cannot be fixed (e.g., when comes from libraries), - move on to more complex operations, - then start fixing interactive mode.
Diffstat (limited to 'gfx')
-rw-r--r--gfx/cro.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gfx/cro.c b/gfx/cro.c
index bf51cb5..6f9ad6d 100644
--- a/gfx/cro.c
+++ b/gfx/cro.c
@@ -714,10 +714,16 @@ static int cr_png_end(void *ctx)
{
struct cro_ctx *cc = ctx;
int w, h, stride;
+ uint32_t *data;
- cro_img_end(cc, &w, &h, &stride);
+ data = cro_img_end(cc, &w, &h, &stride);
cro_img_write(cc->s, cc->output_name);
+ cairo_surface_destroy(cc->s);
+ cairo_destroy(cc->cr);
+ free(data);
+ free(cc);
+
return 0;
}