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;
}
g_slist_foreach( data->torrents, (GFunc)g_object_unref, NULL );
gtk_widget_destroy( GTK_WIDGET( dialog ) );
+ g_slist_free( data->torrents );
g_free( data );
}
static void
freeMetaUI( gpointer p )
{
- MakeMetaUI * ui = (MakeMetaUI *) p;
+ MakeMetaUI * ui = p;
tr_metaInfoBuilderFree( ui->builder );
memset( ui, ~0, sizeof(MakeMetaUI) );
g_free( ui );
void
tr_metaInfoBuilderFree( tr_metainfo_builder * builder )
{
- if( builder != NULL )
+ if( builder )
{
uint32_t i;
for( i=0; i<builder->fileCount; ++i )
{
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 );
return handle->configDir;
}
-
const char *
tr_getTorrentDir( const tr_handle * handle )
{
void
tr_close( tr_handle * h )
{
+ int i;
const int maxwait_msec = SHUTDOWN_MAX_SECONDS * 1000;
const uint64_t deadline = tr_date( ) + maxwait_msec;
tr_fdClose( );
tr_lockFree( h->lock );
+ for( i=0; i<h->metainfoLookupCount; ++i )
+ tr_free( h->metainfoLookup[i].filename );
+ tr_free( h->metainfoLookup );
tr_free( h->tag );
tr_free( h->configDir );
tr_free( h->resumeDir );