diff --git a/gtk/dialogs.c b/gtk/dialogs.c index adcc3d20a..afc568bd6 100644 --- a/gtk/dialogs.c +++ b/gtk/dialogs.c @@ -152,6 +152,7 @@ removeTorrents( struct DeleteData * data ) for( l=data->torrents; l!=NULL; l=l->next ) tr_core_remove_torrent( data->core, l->data, data->delete_files ); g_slist_free( data->torrents ); + data->torrents = NULL; } @@ -166,6 +167,7 @@ removeResponse( GtkDialog * dialog, gint response, gpointer gdata ) g_slist_foreach( data->torrents, (GFunc)g_object_unref, NULL ); gtk_widget_destroy( GTK_WIDGET( dialog ) ); + g_slist_free( data->torrents ); g_free( data ); } diff --git a/gtk/makemeta-ui.c b/gtk/makemeta-ui.c index 2d724f038..93f24b525 100644 --- a/gtk/makemeta-ui.c +++ b/gtk/makemeta-ui.c @@ -44,7 +44,7 @@ MakeMetaUI; static void freeMetaUI( gpointer p ) { - MakeMetaUI * ui = (MakeMetaUI *) p; + MakeMetaUI * ui = p; tr_metaInfoBuilderFree( ui->builder ); memset( ui, ~0, sizeof(MakeMetaUI) ); g_free( ui ); diff --git a/libtransmission/makemeta.c b/libtransmission/makemeta.c index e8a16ad3a..6f4e900db 100644 --- a/libtransmission/makemeta.c +++ b/libtransmission/makemeta.c @@ -167,7 +167,7 @@ tr_metaInfoBuilderCreate( tr_handle * handle, const char * topFile ) void tr_metaInfoBuilderFree( tr_metainfo_builder * builder ) { - if( builder != NULL ) + if( builder ) { uint32_t i; for( i=0; ifileCount; ++i ) @@ -482,6 +482,12 @@ tr_makeMetaInfo( tr_metainfo_builder * builder, { tr_lock * lock; + /* free any variables from a previous run */ + tr_free( builder->announce ); + tr_free( builder->comment ); + tr_free( builder->outputFile ); + + /* initialize the builder variables */ builder->abortFlag = 0; builder->isDone = 0; builder->announce = tr_strdup( announce ); diff --git a/libtransmission/platform.c b/libtransmission/platform.c index 09aaab2e9..c5e443a04 100644 --- a/libtransmission/platform.c +++ b/libtransmission/platform.c @@ -474,7 +474,6 @@ tr_getConfigDir( const tr_handle * handle ) return handle->configDir; } - const char * tr_getTorrentDir( const tr_handle * handle ) { diff --git a/libtransmission/session.c b/libtransmission/session.c index a51f33d71..a94326c55 100644 --- a/libtransmission/session.c +++ b/libtransmission/session.c @@ -415,6 +415,7 @@ deadlineReached( const uint64_t deadline ) void tr_close( tr_handle * h ) { + int i; const int maxwait_msec = SHUTDOWN_MAX_SECONDS * 1000; const uint64_t deadline = tr_date( ) + maxwait_msec; @@ -430,6 +431,9 @@ tr_close( tr_handle * h ) tr_fdClose( ); tr_lockFree( h->lock ); + for( i=0; imetainfoLookupCount; ++i ) + tr_free( h->metainfoLookup[i].filename ); + tr_free( h->metainfoLookup ); tr_free( h->tag ); tr_free( h->configDir ); tr_free( h->resumeDir );