(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
|
@ -2833,13 +2833,9 @@ deleteLocalData( tr_torrent * tor, tr_fileFunc func )
|
||||||
/* build a list of 'top's child directories that belong to this torrent */
|
/* build a list of 'top's child directories that belong to this torrent */
|
||||||
for( f=0; f<tor->info.fileCount; ++f )
|
for( f=0; f<tor->info.fileCount; ++f )
|
||||||
{
|
{
|
||||||
char * dir;
|
|
||||||
char * filename;
|
|
||||||
|
|
||||||
/* get the directory that this file goes in... */
|
/* get the directory that this file goes in... */
|
||||||
filename = tr_buildPath( top, tor->info.files[f].name, NULL );
|
char * filename = tr_buildPath( top, tor->info.files[f].name, NULL );
|
||||||
dir = tr_dirname( filename );
|
char * dir = tr_dirname( filename );
|
||||||
tr_free( filename );
|
|
||||||
if( !tr_is_same_file( top, dir ) && strcmp( top, dir ) ) {
|
if( !tr_is_same_file( top, dir ) && strcmp( top, dir ) ) {
|
||||||
for( ;; ) {
|
for( ;; ) {
|
||||||
char * parent = tr_dirname( dir );
|
char * parent = tr_dirname( dir );
|
||||||
|
@ -2853,6 +2849,8 @@ deleteLocalData( tr_torrent * tor, tr_fileFunc func )
|
||||||
dir = parent;
|
dir = parent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
tr_free( dir );
|
||||||
|
tr_free( filename );
|
||||||
}
|
}
|
||||||
for( i=0, n=tr_ptrArraySize(&folders); i<n; ++i )
|
for( i=0, n=tr_ptrArraySize(&folders); i<n; ++i )
|
||||||
removeEmptyFoldersAndJunkFiles( tr_ptrArrayNth( &folders, i ) );
|
removeEmptyFoldersAndJunkFiles( tr_ptrArrayNth( &folders, i ) );
|
||||||
|
|
Loading…
Reference in New Issue