Corrected a failure (in the code for many a decade) to properly

clean up memory after running "ext2spice".  There are apparently
still memory leaks somewhere, difficult to diagnose with valgrind,
but this fix removes the most substantial leakage and allows
"ext2spice" to be run continuously, at least for a while.
This commit is contained in:
Tim Edwards 2021-12-13 16:12:30 -05:00
parent 859879ce5d
commit 82f280e23e
2 changed files with 16 additions and 2 deletions

View File

@ -162,6 +162,12 @@ EFDone()
}
HashKill(&efDevParamTable);
HashStartSearch(&hs);
while (he = HashNext(&efFreeHashTable, &hs))
{
/* Keys of this table are entries to be free'd */
freeMagic(he->h_key.h_ptr);
}
HashKill(&efFreeHashTable);
/* Final cleanup */

View File

@ -351,8 +351,16 @@ ExtGetDevInfo(idx, devnameptr, devtypeptr, s_rclassptr, d_rclassptr,
}
if (found == TRUE) break;
}
if (t == DBNumTypes) return FALSE;
if (devptr == NULL) return FALSE;
if (t == DBNumTypes)
{
freeMagic(uniquenamelist);
return FALSE;
}
if (devptr == NULL)
{
freeMagic(uniquenamelist);
return FALSE;
}
if (devnameptr) *devnameptr = locdname;
if (subnameptr) *subnameptr = devptr->exts_deviceSubstrateName;