Fix a free(NULL) in min_heap.h

Backport of 6f20492fa27f08
This commit is contained in:
Nick Mathewson 2010-03-26 14:22:47 -04:00
parent 01ea0c5c28
commit 245893479a

View File

@ -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; }