forked from Telodendria/Telodendria
Fix "bad pointer" warnings.
This commit is contained in:
parent
fe57f07fee
commit
1282371680
2 changed files with 13 additions and 2 deletions
2
src/Db.c
2
src/Db.c
|
@ -511,7 +511,7 @@ DbLockFromArr(Db * db, Array * args)
|
||||||
}
|
}
|
||||||
ref->name = name;
|
ref->name = name;
|
||||||
|
|
||||||
HashMapSet(db->cache, hash, ref);
|
HashMapSet(db->cache, UtilStringDuplicate(hash), ref);
|
||||||
db->cacheSize += ref->size;
|
db->cacheSize += ref->size;
|
||||||
|
|
||||||
ref->next = NULL;
|
ref->next = NULL;
|
||||||
|
|
13
src/Json.c
13
src/Json.c
|
@ -645,7 +645,18 @@ JsonFree(HashMap * object)
|
||||||
|
|
||||||
while (HashMapIterate(object, &key, (void **) &value))
|
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);
|
JsonValueFree(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue