From 7c6fbfb80f30ecec8fb4fd9f2ede0c3035049167 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 22 May 2009 19:03:00 +0000 Subject: [PATCH] (trunk libT) fix a couple of dead assignments, and a possible null pointer dereference, found by clang --- libtransmission/bandwidth.c | 3 --- libtransmission/handshake.c | 2 +- libtransmission/tr-dht.c | 1 - 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/libtransmission/bandwidth.c b/libtransmission/bandwidth.c index 4672cfdde..ac7f4d680 100644 --- a/libtransmission/bandwidth.c +++ b/libtransmission/bandwidth.c @@ -349,15 +349,12 @@ bandwidthUsedImpl( tr_bandwidth * b, uint64_t now ) { struct tr_band * band; - size_t oldBytesLeft; assert( tr_isBandwidth( b ) ); assert( tr_isDirection( dir ) ); band = &b->band[dir]; - oldBytesLeft = band->bytesLeft; - if( band->isLimited && isPieceData ) band->bytesLeft -= MIN( band->bytesLeft, byteCount ); diff --git a/libtransmission/handshake.c b/libtransmission/handshake.c index 90df9f3c0..7e8aaba58 100644 --- a/libtransmission/handshake.c +++ b/libtransmission/handshake.c @@ -321,7 +321,7 @@ parseHandshake( tr_handshake * handshake, tr_peerIoEnableFEXT( handshake->io, HANDSHAKE_HAS_FASTEXT( reserved ) ); /* This doesn't depend on whether the torrent is private. */ - if( tor->session->isDHTEnabled ) + if( tor && tor->session->isDHTEnabled ) tr_peerIoEnableDHT( handshake->io, HANDSHAKE_HAS_DHT( reserved ) ); return HANDSHAKE_OK; diff --git a/libtransmission/tr-dht.c b/libtransmission/tr-dht.c index 0c26e940b..2250f8cf1 100644 --- a/libtransmission/tr-dht.c +++ b/libtransmission/tr-dht.c @@ -149,7 +149,6 @@ tr_dhtInit(tr_session *ss) /* Note that DHT ids need to be distributed uniformly, * so it should be something truly random. */ tr_cryptoRandBuf( myid, 20 ); - have_id = TRUE; } v[0] = 'T';