fix looong-standing potential dangling pointer bug reported by BMW
This commit is contained in:
parent
6ed2d25af7
commit
77d7cf76a1
|
@ -1320,7 +1320,7 @@ tr_peerMgrPeerStats( const tr_peerMgr * manager,
|
|||
tr_netNtop( &peer->in_addr, stat->addr, sizeof(stat->addr) );
|
||||
stat->port = peer->port;
|
||||
stat->from = atom->from;
|
||||
stat->client = peer->client;
|
||||
stat->client = tr_strdup( peer->client ? peer->client : "" );
|
||||
stat->progress = peer->progress;
|
||||
stat->isEncrypted = tr_peerIoIsEncrypted( peer->io ) ? 1 : 0;
|
||||
stat->uploadToRate = tr_rcRate( peer->rateToPeer );
|
||||
|
|
|
@ -904,8 +904,12 @@ tr_torrentPeers( const tr_torrent * tor, int * peerCount )
|
|||
tor->info.hash, peerCount );
|
||||
}
|
||||
|
||||
void tr_torrentPeersFree( tr_peer_stat * peers, int peerCount UNUSED )
|
||||
void
|
||||
tr_torrentPeersFree( tr_peer_stat * peers, int peerCount )
|
||||
{
|
||||
int i;
|
||||
for( i=0; i<peerCount; ++i )
|
||||
tr_free( (char*) peers[i].client );
|
||||
tr_free( peers );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue