From f6eea9e5915677ee2ec8aecb77220d92717d5a3e Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Sun, 13 Aug 2006 21:24:23 +0000 Subject: [PATCH] Free even more memory. --- libtransmission/transmission.c | 6 +++++- libtransmission/transmission.h | 2 +- macosx/Torrent.m | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libtransmission/transmission.c b/libtransmission/transmission.c index d52ff5e0c..8699b7f55 100644 --- a/libtransmission/transmission.c +++ b/libtransmission/transmission.c @@ -506,8 +506,12 @@ tr_peer_stat_t * tr_torrentPeers( tr_torrent_t * tor, int * peerCount ) return peers; } -void tr_torrentPeersFree( tr_peer_stat_t * peers ) +void tr_torrentPeersFree( tr_peer_stat_t * peers, int peerCount ) { + int i; + for (i = 0; i < peerCount; i++) + free(peers[i].client); + free( peers ); } diff --git a/libtransmission/transmission.h b/libtransmission/transmission.h index 56378e45c..fba34a986 100644 --- a/libtransmission/transmission.h +++ b/libtransmission/transmission.h @@ -215,7 +215,7 @@ tr_stat_t * tr_torrentStat( tr_torrent_t * ); ***********************************************************************/ typedef struct tr_peer_stat_s tr_peer_stat_t; tr_peer_stat_t * tr_torrentPeers( tr_torrent_t *, int * peerCount ); -void tr_torrentPeersFree( tr_peer_stat_t * ); +void tr_torrentPeersFree( tr_peer_stat_t *, int peerCount ); /*********************************************************************** * tr_torrentAvailability diff --git a/macosx/Torrent.m b/macosx/Torrent.m index 51f100821..6499dac53 100644 --- a/macosx/Torrent.m +++ b/macosx/Torrent.m @@ -534,6 +534,8 @@ } //NSLog(@"%d", tr_peerId(peer)); + tr_torrentPeersFree(peers, totalPeers); + return peerDics; }