Fix a memory leak.

This commit is contained in:
Mitchell Livingston 2006-08-13 19:55:59 +00:00
parent f76f1c3091
commit e392a84e36
3 changed files with 3 additions and 16 deletions

View File

@ -440,15 +440,7 @@ tr_stat_t * tr_torrentStat( tr_torrent_t * tor )
{
peer = tor->peers[i];
char * client = tr_clientForId(tr_peerId(peer));
char clientChar;
int j = 0;
while (j < 25 && (clientChar = client[j]) != 0)
{
s->peers[i].client[j] = clientChar;
j++;
}
s->peers[i].client = tr_clientForId(tr_peerId(peer));
s->peers[i].isDownloading = tr_peerIsDownloading(peer);
s->peers[i].isUploading = tr_peerIsUploading(peer);

View File

@ -281,7 +281,7 @@ struct tr_info_s
**********************************************************************/
typedef struct tr_peer_stat_s
{
char client[25];
char * client;
int isDownloading;
int isUploading;

View File

@ -526,14 +526,9 @@
peer = fStat->peers[i];
[peers addObject: [NSDictionary dictionaryWithObjectsAndKeys:
[NSString stringWithCString: (char *) peer.client encoding: NSUTF8StringEncoding],
@"Client",
[NSString stringWithCString: (char *) peer.client encoding: NSUTF8StringEncoding], @"Client",
[NSNumber numberWithBool: peer.isDownloading], @"UL To",
[NSNumber numberWithBool: peer.isUploading], @"DL From", nil]];
/*[peers addObject: [NSDictionary dictionaryWithObjectsAndKeys:
@"Client", @"Client",
[NSNumber numberWithBool: YES], @"UL To",
[NSNumber numberWithBool: YES], @"DL From", nil]];*/
}
//NSLog(@"%d", tr_peerId(peer));