From 4c2434ab67231e528959ffc37d38cf2da9506042 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 1 Jan 2018 11:40:04 +0000 Subject: [PATCH] fix memleak in dzsave tree elements were not being freed, thanks lovell see https://github.com/jcupitt/libvips/issues/837 --- ChangeLog | 1 + libvips/foreign/dzsave.c | 13 +++++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8b2f64ae..c51e3156 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ - fix a memleak on error during jpeg buffer write [lovell] - fix misspelling of IPTC as IPCT [lovell] - seq could be set on small images opened in random-access mode [aferrero2707] +- fix small memleak in dzsave [lovell] 15/4/17 started 8.6.0 - supports fits images with leading non-image HDUs, thanks benepo diff --git a/libvips/foreign/dzsave.c b/libvips/foreign/dzsave.c index e2be0363..44d3ed82 100644 --- a/libvips/foreign/dzsave.c +++ b/libvips/foreign/dzsave.c @@ -74,7 +74,8 @@ * 18/8/17 * - shut down the output earlier to flush zip output * 24/11/17 - * - output overlap-only tiles on edges, for better deepzoom spec + * - output overlap-only tiles on edges for better deepzoom spec + * compliance */ /* @@ -179,7 +180,7 @@ */ typedef struct _VipsGsfDirectory { struct _VipsGsfDirectory *parent; - const char *name; + char *name; /* List of child directories, if any. */ @@ -222,7 +223,7 @@ vips_gsf_tree_close( VipsGsfDirectory *tree ) return( tree ); } - g_object_unref( tree->out ); + VIPS_UNREF( tree->out ); } if( tree->container ) { @@ -233,9 +234,13 @@ vips_gsf_tree_close( VipsGsfDirectory *tree ) return( tree ); } - g_object_unref( tree->container ); + VIPS_UNREF( tree->container ); } + VIPS_FREEF( g_slist_free, tree->children ); + VIPS_FREE( tree->name ); + VIPS_FREE( tree ); + return( NULL ); }