mirror of
https://github.com/transmission/transmission
synced 2025-03-03 18:25:35 +00:00
(trunk libT) fix minor memory leak of the 'dir' string when deleting local data. (Thanks, valgrind!)
This commit is contained in:
parent
a107ad81ab
commit
43f7dc4c17
1 changed files with 4 additions and 6 deletions
|
@ -2833,13 +2833,9 @@ deleteLocalData( tr_torrent * tor, tr_fileFunc func )
|
|||
/* build a list of 'top's child directories that belong to this torrent */
|
||||
for( f=0; f<tor->info.fileCount; ++f )
|
||||
{
|
||||
char * dir;
|
||||
char * filename;
|
||||
|
||||
/* get the directory that this file goes in... */
|
||||
filename = tr_buildPath( top, tor->info.files[f].name, NULL );
|
||||
dir = tr_dirname( filename );
|
||||
tr_free( filename );
|
||||
char * filename = tr_buildPath( top, tor->info.files[f].name, NULL );
|
||||
char * dir = tr_dirname( filename );
|
||||
if( !tr_is_same_file( top, dir ) && strcmp( top, dir ) ) {
|
||||
for( ;; ) {
|
||||
char * parent = tr_dirname( dir );
|
||||
|
@ -2853,6 +2849,8 @@ deleteLocalData( tr_torrent * tor, tr_fileFunc func )
|
|||
dir = parent;
|
||||
}
|
||||
}
|
||||
tr_free( dir );
|
||||
tr_free( filename );
|
||||
}
|
||||
for( i=0, n=tr_ptrArraySize(&folders); i<n; ++i )
|
||||
removeEmptyFoldersAndJunkFiles( tr_ptrArrayNth( &folders, i ) );
|
||||
|
|
Loading…
Reference in a new issue