Fix potential NULL deref in libcache

This commit is contained in:
Stuart Reilly
2019-06-28 16:00:32 +01:00
parent 4b71727661
commit bc1b4885de
+5 -1
View File
@@ -196,7 +196,11 @@ cache_result cache_add(cache_t cache, void *item, uint32_t item_size) {
}
if(hash_entry_map_prev) {
hash_entry_map_prev->next = hash_entry_map->next;
if (hash_entry_map) {
hash_entry_map_prev->next = hash_entry_map->next;
} else {
hash_entry_map_prev->next = NULL;
}
} else {
cache->map[hash] = hash_entry_map->next;
}