]> granicus.if.org Git - transmission/commitdiff
Fix leak of torrents
authorMukund Sivaraman <muks@mukund.org>
Thu, 14 Aug 2008 10:39:27 +0000 (10:39 +0000)
committerMukund Sivaraman <muks@mukund.org>
Thu, 14 Aug 2008 10:39:27 +0000 (10:39 +0000)
libtransmission/rpc.c

index b5357cebfd2f891d39b22c4caafd39c79d4e1730..9450861017793186ee014831c940ea0cfb8cd853 100644 (file)
@@ -363,15 +363,19 @@ torrentGet( tr_handle * handle, tr_benc * args_in, tr_benc * args_out )
     tr_torrent ** torrents = getTorrents( handle, args_in, &torrentCount );
     tr_benc * list = tr_bencDictAddList( args_out, "torrents", torrentCount );
     tr_benc * fields;
+    char *msg = NULL;
 
-    if( !tr_bencDictFindList( args_in, "fields", &fields ) )
-        return "no fields specified";
+    if( !tr_bencDictFindList( args_in, "fields", &fields ) ) {
+        msg = "no fields specified";
+        goto out;
+    }
 
     for( i=0; i<torrentCount; ++i )
         addInfo( torrents[i], tr_bencListAdd( list ), fields );
 
+out:
     tr_free( torrents );
-    return NULL;
+    return msg;
 }
 
 /***