From: Charles Kerr Date: Sat, 24 Jan 2009 02:33:25 +0000 (+0000) Subject: (trunk libT) #1743: potential threading issue in tr_list. only affects 1.50b[1-3] X-Git-Tag: 1.60~435 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ce9eff1fb20ef3198721d33c581812ec98ca4247;p=transmission (trunk libT) #1743: potential threading issue in tr_list. only affects 1.50b[1-3] --- diff --git a/libtransmission/list.c b/libtransmission/list.c index e98e0b2bb..948c903d9 100644 --- a/libtransmission/list.c +++ b/libtransmission/list.c @@ -14,39 +14,16 @@ #include "list.h" #include "utils.h" -/*** -**** -***/ - -static tr_list * _unusedNodes = NULL; - -static const tr_list TR_LIST_INIT = { NULL, NULL, NULL }; - static tr_list* node_alloc( void ) { - tr_list * node; - - if( _unusedNodes == NULL ) - node = tr_new( tr_list, 1 ); - else { - node = _unusedNodes; - _unusedNodes = node->next; - } - - *node = TR_LIST_INIT; - return node; + return tr_new0( tr_list, 1 ); } static void node_free( tr_list* node ) { - if( node ) - { - *node = TR_LIST_INIT; - node->next = _unusedNodes; - _unusedNodes = node; - } + tr_free( node ); } /***