From 67c1c6db95b6389006396de3bdaf0b8127b9d4f0 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 7 Aug 2009 00:58:34 +0000 Subject: [PATCH] (trunk libT) possible fix for #2301, which is a valgrind complaint about uninitialized memory being written to disk while saving the bencoded .resume file. this commit theorizes that the warning is caused by not zeroing out the tr_peer array before filling it, so the extra bits in tr_addresses' ipv4/ipv6 union were never initialized. if this theory is correct, this commit (which zeros the memory first) should fix the bug. --- libtransmission/peer-mgr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libtransmission/peer-mgr.c b/libtransmission/peer-mgr.c index f3d7f16b8..46e3677e3 100644 --- a/libtransmission/peer-mgr.c +++ b/libtransmission/peer-mgr.c @@ -1537,7 +1537,7 @@ tr_peerMgrGetPeers( tr_torrent * tor, const int peerCount = tr_ptrArraySize( &t->peers ); /* for now, this will waste memory on torrents that have both * ipv6 and ipv4 peers */ - tr_pex * pex = tr_new( tr_pex, peerCount ); + tr_pex * pex = tr_new0( tr_pex, peerCount ); tr_pex * walk = pex; for( i=0; i