summaryrefslogtreecommitdiff
path: root/usual/heap.c
diff options
context:
space:
mode:
Diffstat (limited to 'usual/heap.c')
-rw-r--r--usual/heap.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usual/heap.c b/usual/heap.c
index 4145f84..79ffcf6 100644
--- a/usual/heap.c
+++ b/usual/heap.c
@@ -126,8 +126,10 @@ struct Heap *heap_create(heap_is_better_f is_better_cb, heap_save_pos_f save_pos
void heap_destroy(struct Heap *h)
{
- cx_free(h->cx, h->data);
- cx_free(h->cx, h);
+ if (h) {
+ cx_free(h->cx, h->data);
+ cx_free(h->cx, h);
+ }
}
bool heap_reserve(struct Heap *h, unsigned extra)