]> granicus.if.org Git - libevent/commitdiff
Fix a free(NULL) in minheap-internal.h
authorNick Mathewson <nickm@torproject.org>
Fri, 26 Mar 2010 18:20:10 +0000 (14:20 -0400)
committerNick Mathewson <nickm@torproject.org>
Fri, 26 Mar 2010 18:20:10 +0000 (14:20 -0400)
minheap-internal.h

index 8253dfe78511a37f1dd7a3c03442ea8cc1b2861d..4739daf4017cc2aa3f1c9227a2361fe23874ef93 100644 (file)
@@ -62,7 +62,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) { mm_free(s->p); }
+void min_heap_dtor(min_heap_t* s) { if (s->p) mm_free(s->p); }
 void min_heap_elem_init(struct event* e) { e->ev_timeout_pos.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; }