(trunk) fix a couple of memory leaks.

This commit is contained in:
Charles Kerr 2009-05-14 17:18:17 +00:00
parent da42fe8a7c
commit 7aa58580f3
2 changed files with 10 additions and 7 deletions

View File

@ -519,15 +519,18 @@ scanWatchDir( TrCore * core )
if( isEnabled )
{
const char * dirname = pref_string_get( PREF_KEY_DIR_WATCH );
GDir * dir = g_dir_open( dirname, 0, NULL );
const char * basename;
while( ( basename = g_dir_read_name( dir ) ) )
const char * dirname = pref_string_get( PREF_KEY_DIR_WATCH );
GDir * dir = g_dir_open( dirname, 0, NULL );
while(( basename = g_dir_read_name( dir )))
{
char * filename = g_build_filename( dirname, basename, NULL );
maybeAddTorrent( core, filename );
g_free( filename );
}
g_dir_close( dir );
}
}
@ -859,16 +862,13 @@ add_filename( TrCore * core,
if( filename && session )
{
tr_ctor * ctor;
ctor = tr_ctorNew( session );
tr_ctor * ctor = tr_ctorNew( session );
tr_core_apply_defaults( ctor );
tr_ctorSetPaused( ctor, TR_FORCE, !doStart );
if( tr_ctorSetMetainfoFromFile( ctor, filename ) )
{
tr_core_errsig( core, TR_EINVALID, filename );
tr_ctorFree( ctor );
}
else
{
@ -904,6 +904,8 @@ add_filename( TrCore * core,
break;
}
}
tr_ctorFree( ctor );
}
}

View File

@ -818,6 +818,7 @@ closeServer( void * vserver )
#ifdef HAVE_ZLIB
deflateEnd( &s->stream );
#endif
tr_free( s->sessionId );
tr_free( s->whitelistStr );
tr_free( s->username );
tr_free( s->password );