1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 09:13:06 +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
readResponseIdle( void * vresponse )
{
GByteArray * response;
tr_benc top;
int64_t intVal;
int tag;
struct pending_request_data * data;
GByteArray * response = vresponse;
response = vresponse;
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( data && data->responseFunc )
(*data->responseFunc)(data->core, &top, data->responseFuncUserData );
if( tr_bencDictFindInt( &top, "tag", &intVal ) )
{
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 );
g_hash_table_remove( pendingRequests, &tag );
g_byte_array_free( response, TRUE );
return FALSE;
}