Fix "bad pointer" warnings.

This commit is contained in:
Jordan Bancino 2023-01-06 18:50:31 +00:00
parent fe57f07fee
commit 1282371680
2 changed files with 13 additions and 2 deletions

View file

@ -511,7 +511,7 @@ DbLockFromArr(Db * db, Array * args)
}
ref->name = name;
HashMapSet(db->cache, hash, ref);
HashMapSet(db->cache, UtilStringDuplicate(hash), ref);
db->cacheSize += ref->size;
ref->next = NULL;

View file

@ -645,7 +645,18 @@ JsonFree(HashMap * object)
while (HashMapIterate(object, &key, (void **) &value))
{
Free(key);
/*
* The key might not always be on the heap. In cases
* where the JSON object is built programmatically instead
* of with the parser, stack strings will probably have been
* used as the key.
*/
MemoryInfo *i = MemoryInfoGet(key);
if (i)
{
Free(key);
}
JsonValueFree(value);
}