1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-26 01:27:28 +00:00

(trunk gtk) fix a minor UMR error that Valgrind found

This commit is contained in:
Charles Kerr 2010-09-23 17:05:40 +00:00
parent 80582f8ccc
commit 6e62d0d99d

View file

@ -1589,23 +1589,24 @@ static GHashTable * pendingRequests = NULL;
static gboolean static gboolean
readResponseIdle( void * vresponse ) readResponseIdle( void * vresponse )
{ {
GByteArray * response;
tr_benc top; tr_benc top;
int64_t intVal; int64_t intVal;
int tag; GByteArray * response = vresponse;
struct pending_request_data * data;
response = vresponse;
tr_jsonParse( NULL, response->data, response->len, &top, NULL ); tr_jsonParse( NULL, response->data, response->len, &top, NULL );
tr_bencDictFindInt( &top, "tag", &intVal );
tag = (int)intVal;
data = g_hash_table_lookup( pendingRequests, &tag ); if( tr_bencDictFindInt( &top, "tag", &intVal ) )
if( data && data->responseFunc ) {
(*data->responseFunc)(data->core, &top, data->responseFuncUserData ); const int tag = (int)intVal;
struct pending_request_data * data = g_hash_table_lookup( pendingRequests, &tag );
if( data ) {
if( data->responseFunc )
(*data->responseFunc)(data->core, &top, data->responseFuncUserData );
g_hash_table_remove( pendingRequests, &tag );
}
}
tr_bencFree( &top ); tr_bencFree( &top );
g_hash_table_remove( pendingRequests, &tag );
g_byte_array_free( response, TRUE ); g_byte_array_free( response, TRUE );
return FALSE; return FALSE;
} }