1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-02-23 22:50:41 +00:00

(libT) #5259 'Minor memory leak in tr_torrentDeleteLocalData()' -- fixed.

This commit is contained in:
Jordan Lee 2013-01-27 06:19:33 +00:00
parent 5f9e7f773b
commit d9940acf75

View file

@ -2830,14 +2830,14 @@ deleteLocalData (tr_torrent * tor, tr_fileFunc func)
if (!tr_is_same_file (top, dir) && strcmp (top, dir)) {
for (;;) {
char * parent = tr_dirname (dir);
if (tr_is_same_file (top, parent) || !strcmp (top, parent)) {
if (tr_ptrArrayFindSorted (&folders, dir, vstrcmp) == NULL) {
tr_ptrArrayInsertSorted (&folders, tr_strdup (dir), vstrcmp);
}
break;
}
tr_free (dir);
const bool done_walking = tr_is_same_file (top, parent) || !strcmp (top, parent);
if (done_walking && tr_ptrArrayFindSorted (&folders, dir, vstrcmp))
tr_ptrArrayInsertSorted (&folders, dir, vstrcmp); /* folders assumes ownership of dir */
else
tr_free (dir);
dir = parent;
if (done_walking)
break;
}
}
tr_free (dir);