From c8bec40e3f73027aaae075a73dff5fb85e47344a Mon Sep 17 00:00:00 2001 From: Jordan Lee Date: Thu, 31 Mar 2011 03:37:50 +0000 Subject: [PATCH] (trunk libT) fix potential null pointer dereference in announcer.c --- libtransmission/announcer.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/libtransmission/announcer.c b/libtransmission/announcer.c index 14ef454e0..9d6a337ec 100644 --- a/libtransmission/announcer.c +++ b/libtransmission/announcer.c @@ -589,8 +589,8 @@ filter_trackers( tr_tracker_info * input, int input_count, int * setme_count ) /* if two announce URLs differ only by scheme, put them in the same tier. * (note: this can leave gaps in the `tier' values, but since the calling * function doesn't care, there's no point in removing the gaps...) */ - for( i=0, in=n; icurrentTracker )) + { tracker->consecutiveFailures = 0; + tracker->seederCount = response->seeders; + tracker->leecherCount = response->leechers; + tracker->downloadCount = response->downloads; + + if(( str = response->tracker_id_str )) + { + tr_free( tracker->tracker_id_str ); + tracker->tracker_id_str = tr_strdup( str ); + } + } if(( str = response->warning )) { @@ -1077,16 +1088,6 @@ on_announce_done( const tr_announce_response * response, if(( i = response->interval )) tier->announceIntervalSec = i; - if(( str = response->tracker_id_str )) - { - tr_free( tier->currentTracker->tracker_id_str ); - tier->currentTracker->tracker_id_str = tr_strdup( str ); - } - - tier->currentTracker->seederCount = response->seeders; - tier->currentTracker->leecherCount = response->leechers; - tier->currentTracker->downloadCount = response->downloads; - if( response->pex_count > 0 ) publishPeersPex( tier, response->seeders, response->leechers, response->pex, response->pex_count ); -- 2.40.0