runtime_loader: code clean up after hrev53827

avoid double free in destructor.

Change-Id: I28bd412b2323c3d80e63711885e87dd64e6165fc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2224
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
This commit is contained in:
Jérôme Duval 2020-02-06 17:06:56 +01:00 committed by Axel Dörfler
parent b8476a30d7
commit 4438fc6589

View File

@ -69,14 +69,17 @@ struct SymbolLookupCache {
size_t elementCount = (fTableSize + 31) / 32;
fValuesResolved = (uint32*)malloc(4 * elementCount);
if (fValuesResolved != NULL)
memset(fValuesResolved, 0, 4 * elementCount);
if (fValues == NULL || fDSOs == NULL || fValuesResolved == NULL) {
free(fValuesResolved);
fValuesResolved = NULL;
free(fValues);
fValues = NULL;
free(fDSOs);
fDSOs = NULL;
fTableSize = 0;
} else {
memset(fValuesResolved, 0, 4 * elementCount);
}
}
}