Fix a free(NULL) in minheap-internal.h

This commit is contained in:
Nick Mathewson 2010-03-26 14:20:10 -04:00
parent a5276180b7
commit 6f20492fa2

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