(trunk libT) fix a couple of dead assignments, and a possible null pointer dereference, found by clang

This commit is contained in:
Charles Kerr 2009-05-22 19:03:00 +00:00
parent 6044947ab0
commit 7c6fbfb80f
3 changed files with 1 additions and 5 deletions

View File

@ -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 );

View File

@ -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;

View File

@ -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';