summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-03-26 14:22:47 -0400
committerNick Mathewson <nickm@torproject.org>2010-03-26 14:22:47 -0400
commit245893479aea5d36cc8d500ad8a553a60bb15cc6 (patch)
treeaacd25af3a65cf3c7da8008e05e6047fff027ead
parent01ea0c5c285eb0ebe56b848b7ae147eb7b4509c8 (diff)
downloadlibevent-245893479aea5d36cc8d500ad8a553a60bb15cc6.tar.gz
Fix a free(NULL) in min_heap.h
Backport of 6f20492fa27f08
-rw-r--r--min_heap.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/min_heap.h b/min_heap.h
index 4fc83c01..14d8e370 100644
--- a/min_heap.h
+++ b/min_heap.h
@@ -56,7 +56,7 @@ int min_heap_elem_greater(struct event *a, struct event *b)
}
void min_heap_ctor(min_heap_t* s) { s->p = 0; s->n = 0; s->a = 0; }
-void min_heap_dtor(min_heap_t* s) { free(s->p); }
+void min_heap_dtor(min_heap_t* s) { if(s->p) free(s->p); }
void min_heap_elem_init(struct event* e) { e->min_heap_idx = -1; }
int min_heap_empty(min_heap_t* s) { return 0u == s->n; }
unsigned min_heap_size(min_heap_t* s) { return s->n; }