]> granicus.if.org Git - transmission/commitdiff
fix NULL-pointer-dereference regression introduced in r13546 for #5069.
authorJordan Lee <jordan@transmissionbt.com>
Sat, 13 Oct 2012 17:32:23 +0000 (17:32 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Sat, 13 Oct 2012 17:32:23 +0000 (17:32 +0000)
libtransmission/webseed.c

index a7edcf1afb5eeef2ac1953359494bc117d8acbb5..82c2474a43bb040c5cdad0394041a3d0eefe8da6 100644 (file)
@@ -80,9 +80,12 @@ webseed_free( struct tr_webseed * w )
     const tr_info * inf = tr_torrentInfo( tor );
     tr_file_index_t i;
 
-    for( i=0; i<inf->fileCount; ++i )
-        tr_free( w->file_urls[i] );
-    tr_free( w->file_urls );
+    /* if we have an array of file URLs, free it */
+    if( w->file_urls != NULL ) {
+        for( i=0; i<inf->fileCount; ++i )
+            tr_free( w->file_urls[i] );
+        tr_free( w->file_urls );
+    }
 
     /* webseed destruct */
     event_free( w->timer );