From b2b7409138aea92cb2b65b2d22a411d18138555a Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Thu, 11 Jun 2009 02:16:42 +0000 Subject: [PATCH] (trunk gtk) #2170: Segfault when accessing torrent Properties --- gtk/file-list.c | 1 + gtk/tr-core.c | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/gtk/file-list.c b/gtk/file-list.c index ec77bbbc7..fe9eac12e 100644 --- a/gtk/file-list.c +++ b/gtk/file-list.c @@ -513,6 +513,7 @@ file_list_set_torrent( GtkWidget * w, int torrentId ) /* cleanup */ g_node_destroy( root ); + g_free( root_data->name ); g_free( root_data ); } diff --git a/gtk/tr-core.c b/gtk/tr-core.c index 014f10e00..971f56378 100644 --- a/gtk/tr-core.c +++ b/gtk/tr-core.c @@ -1297,7 +1297,6 @@ typedef void ( server_response_func )( TrCore * core, tr_benc * response, gpoint struct pending_request_data { - int tag; TrCore * core; server_response_func * responseFunc; gpointer responseFuncUserData; @@ -1351,7 +1350,7 @@ sendRequest( TrCore * core, const char * json, int tag, if( pendingRequests == NULL ) { - pendingRequests = g_hash_table_new_full( g_int_hash, g_int_equal, NULL, g_free ); + pendingRequests = g_hash_table_new_full( g_int_hash, g_int_equal, g_free, g_free ); } if( session == NULL ) @@ -1364,10 +1363,9 @@ sendRequest( TrCore * core, const char * json, int tag, struct pending_request_data * data; data = g_new0( struct pending_request_data, 1 ); data->core = core; - data->tag = tag; data->responseFunc = responseFunc; data->responseFuncUserData = responseFuncUserData; - g_hash_table_insert( pendingRequests, &data->tag, data ); + g_hash_table_insert( pendingRequests, g_memdup( &tag, sizeof( int ) ), data ); /* make the request */ #ifdef DEBUG_RPC