aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--analyzer/structures/hashmap.c2
-rw-r--r--analyzer/structures/heap.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/analyzer/structures/hashmap.c b/analyzer/structures/hashmap.c
index ed2eb4b..7a38852 100644
--- a/analyzer/structures/hashmap.c
+++ b/analyzer/structures/hashmap.c
@@ -100,6 +100,8 @@ void hashmap_delete(HashMap *map, void *key) {
}
void hashmap_free(HashMap *map) {
+ if (!map)
+ return;
for (size_t i = 0; i < HASHMAP_TABLE_SIZE; i++) {
HashMapNode *curr = map->table[i];
while (curr) {
diff --git a/analyzer/structures/heap.c b/analyzer/structures/heap.c
index 690aac1..6102940 100644
--- a/analyzer/structures/heap.c
+++ b/analyzer/structures/heap.c
@@ -101,6 +101,8 @@ void heap_top_remove(Heap *heap) {
}
void heap_free(Heap *heap) {
+ if (!heap)
+ return;
for (size_t i = 0; i < heap->n_elements; i++) {
free_heap_element(heap, i);
}