forked from lda/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;
|
||||||
|
|
11
src/Json.c
11
src/Json.c
|
@ -644,8 +644,19 @@ JsonFree(HashMap * object)
|
||||||
JsonValue *value;
|
JsonValue *value;
|
||||||
|
|
||||||
while (HashMapIterate(object, &key, (void **) &value))
|
while (HashMapIterate(object, &key, (void **) &value))
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* 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);
|
Free(key);
|
||||||
|
}
|
||||||
|
|
||||||
JsonValueFree(value);
|
JsonValueFree(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue