From 1090f48900b1ac15c03a49532612aad5b57f8650 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 14 Jan 2014 12:07:50 +0000 Subject: [PATCH] fix two tiny memleaks --- libvips/iofuncs/gate.c | 39 ++++++++++++++++++------------------ libvips/iofuncs/threadpool.c | 2 ++ 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/libvips/iofuncs/gate.c b/libvips/iofuncs/gate.c index 58c60168..9e12ecd3 100644 --- a/libvips/iofuncs/gate.c +++ b/libvips/iofuncs/gate.c @@ -144,25 +144,6 @@ vips_thread_profile_save( VipsThreadProfile *profile ) g_mutex_unlock( vips__global_lock ); } -static void -vips_thread_profile_free( VipsThreadProfile *profile ) -{ - VIPS_DEBUG_MSG( "vips_thread_profile_free: %s\n", profile->name ); - - if( vips__thread_profile ) - vips_thread_profile_save( profile ); - - VIPS_FREEF( g_hash_table_destroy, profile->gates ); - VIPS_FREE( profile ); -} - -void -vips__thread_profile_stop( void ) -{ - if( vips__thread_profile ) - VIPS_FREEF( fclose, vips__thread_fp ); -} - static void vips_thread_gate_block_free( VipsThreadGateBlock *block ) { @@ -178,6 +159,26 @@ vips_thread_gate_free( VipsThreadGate *gate ) VIPS_FREE( gate ); } +static void +vips_thread_profile_free( VipsThreadProfile *profile ) +{ + VIPS_DEBUG_MSG( "vips_thread_profile_free: %s\n", profile->name ); + + if( vips__thread_profile ) + vips_thread_profile_save( profile ); + + VIPS_FREEF( g_hash_table_destroy, profile->gates ); + VIPS_FREEF( vips_thread_gate_free, profile->memory ); + VIPS_FREE( profile ); +} + +void +vips__thread_profile_stop( void ) +{ + if( vips__thread_profile ) + VIPS_FREEF( fclose, vips__thread_fp ); +} + static void vips__thread_profile_init_cb( VipsThreadProfile *profile ) { diff --git a/libvips/iofuncs/threadpool.c b/libvips/iofuncs/threadpool.c index 24ba90c0..360ac1d0 100644 --- a/libvips/iofuncs/threadpool.c +++ b/libvips/iofuncs/threadpool.c @@ -177,6 +177,8 @@ vips_thread_run( gpointer data ) vips__buffer_shutdown(); vips__thread_profile_detach(); + g_free( info ); + return( result ); }