From e20a5cf3df9f1fea31f2ec20ebb93d46a37cc3b5 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 13 Feb 2008 01:33:29 +0000 Subject: [PATCH] fix a possible crash on shutdown --- libtransmission/transmission.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libtransmission/transmission.c b/libtransmission/transmission.c index 5277e164c..a8d695967 100644 --- a/libtransmission/transmission.c +++ b/libtransmission/transmission.c @@ -368,8 +368,11 @@ tr_closeImpl( void * vh ) tr_sharedShuttingDown( h->shared ); tr_trackerShuttingDown( h ); - for( t=h->torrentList; t!=NULL; t=t->next ) - tr_torrentClose( t ); + for( t=h->torrentList; t!=NULL; ) { + tr_torrent * tmp = t; + t = t->next; + tr_torrentClose( tmp ); + } tr_peerMgrFree( h->peerMgr );