Changeset 7788


Ignore:
Timestamp:
Jan 24, 2009, 2:33:25 AM (12 years ago)
Author:
charles
Message:

(trunk libT) #1743: potential threading issue in tr_list. only affects 1.50b[1-3]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/list.c

    r7658 r7788  
    1515#include "utils.h"
    1616
    17 /***
    18 ****
    19 ***/
    20 
    21 static tr_list * _unusedNodes = NULL;
    22 
    23 static const tr_list TR_LIST_INIT = { NULL, NULL, NULL };
    24 
    2517static tr_list*
    2618node_alloc( void )
    2719{
    28     tr_list * node;
    29 
    30     if( _unusedNodes == NULL )
    31         node = tr_new( tr_list, 1 );
    32     else {
    33         node = _unusedNodes;
    34         _unusedNodes = node->next;
    35     }
    36 
    37     *node = TR_LIST_INIT;
    38     return node;
     20    return tr_new0( tr_list, 1 );
    3921}
    4022
     
    4224node_free( tr_list* node )
    4325{
    44     if( node )
    45     {
    46         *node = TR_LIST_INIT;
    47         node->next = _unusedNodes;
    48         _unusedNodes = node;
    49     }
     26    tr_free( node );
    5027}
    5128
Note: See TracChangeset for help on using the changeset viewer.