]> granicus.if.org Git - libevent/commitdiff
Fix minheap code to use replacement malloc functions
authorNick Mathewson <nickm@torproject.org>
Fri, 26 Mar 2010 17:56:01 +0000 (13:56 -0400)
committerNick Mathewson <nickm@torproject.org>
Fri, 26 Mar 2010 17:56:01 +0000 (13:56 -0400)
minheap-internal.h still had an extra realloc and an extra free that
needed to be replaced with mm_realloc and mm_free().

minheap-internal.h

index f877e55eb7d2431e84be70c5bb402291acb08757..8253dfe78511a37f1dd7a3c03442ea8cc1b2861d 100644 (file)
@@ -33,6 +33,7 @@
 #include "event2/event_struct.h"
 #include "event2/util.h"
 #include "util-internal.h"
+#include "mm-internal.h"
 
 typedef struct min_heap
 {
@@ -61,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) { free(s->p); }
+void min_heap_dtor(min_heap_t* s) { 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; }
@@ -121,7 +122,7 @@ int min_heap_reserve(min_heap_t* s, unsigned n)
                unsigned a = s->a ? s->a * 2 : 8;
                if (a < n)
                        a = n;
-               if (!(p = (struct event**)realloc(s->p, a * sizeof *p)))
+               if (!(p = (struct event**)mm_realloc(s->p, a * sizeof *p)))
                        return -1;
                s->p = p;
                s->a = a;