(trunk libT) #4377 "Incomplete Folder removed when sub-folder of Default Location" -- minor revision to r12665 to fix a minor memory leak with the 'subpath' string.

This commit is contained in:
Jordan Lee 2011-08-11 21:02:15 +00:00
parent d9541de52d
commit 6d36b3d763
1 changed files with 6 additions and 7 deletions

View File

@ -2712,12 +2712,10 @@ removeEmptyFoldersAndJunkFiles( const char * folder )
if( strcmp( d->d_name, "." ) && strcmp( d->d_name, ".." ) ) { if( strcmp( d->d_name, "." ) && strcmp( d->d_name, ".." ) ) {
struct stat sb; struct stat sb;
char * filename = tr_buildPath( folder, d->d_name, NULL ); char * filename = tr_buildPath( folder, d->d_name, NULL );
if( !stat( filename, &sb ) ) { if( !stat( filename, &sb ) && S_ISDIR( sb.st_mode ) )
if( S_ISDIR( sb.st_mode ) ) removeEmptyFoldersAndJunkFiles( filename );
removeEmptyFoldersAndJunkFiles( filename ); else if( isJunkFile( d->d_name ) )
else if( isJunkFile( d->d_name ) ) remove( filename );
remove( filename );
}
tr_free( filename ); tr_free( filename );
} }
} }
@ -2774,6 +2772,7 @@ deleteLocalData( tr_torrent * tor, tr_fileFunc func )
tr_free( target_dir ); tr_free( target_dir );
tr_free( target ); tr_free( target );
tr_free( source ); tr_free( source );
tr_free( subpath );
} }
} }
@ -2833,8 +2832,8 @@ deleteLocalData( tr_torrent * tor, tr_fileFunc func )
/* cleanup */ /* cleanup */
rmdir( tmpdir ); rmdir( tmpdir );
tr_free( tmpdir ); tr_free( tmpdir );
tr_ptrArrayDestruct( &files, tr_free );
tr_ptrArrayDestruct( &folders, tr_free ); tr_ptrArrayDestruct( &folders, tr_free );
tr_ptrArrayDestruct( &files, tr_free );
} }
static void static void