From 30aae507a3e3c533eb75f163bf21d76f48e1c356 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 26 Aug 2014 17:07:44 +0100 Subject: [PATCH] fix memleak in tilecache --- ChangeLog | 1 + libvips/conversion/tilecache.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index 64a931c5..4ac51ca8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 21/8/14 started 7.40.7 - fix matlab load +- fix memleak in tilecache [Lovell] 12/8/14 started 7.40.6 - more doc fixes diff --git a/libvips/conversion/tilecache.c b/libvips/conversion/tilecache.c index 9530db3a..1634cdf1 100644 --- a/libvips/conversion/tilecache.c +++ b/libvips/conversion/tilecache.c @@ -29,6 +29,8 @@ * - could deadlock if downstream raised an error (thanks Todd) * 25/4/13 * - cache minimisation is optional, see "persistent" flag + * 26/8/14 Lovell + * - free the hash table in _dispose() */ /* @@ -156,6 +158,10 @@ vips_block_cache_dispose( GObject *gobject ) VIPS_FREEF( vips_g_mutex_free, cache->lock ); VIPS_FREEF( vips_g_cond_free, cache->new_tile ); + if( cache->tiles ) + g_assert( g_hash_table_size( cache->tiles ) == 0 ); + VIPS_FREEF( g_hash_table_destroy, cache->tiles ); + G_OBJECT_CLASS( vips_block_cache_parent_class )->dispose( gobject ); }