index 1b5dca736ba59da0cf05a81ecf4a336dd378bbca..8637581149c890f45577cabb1e902099f52fb82b 100644 (file)
--- a/src/daemon/utils_heap.c
+++ b/src/daemon/utils_heap.c
**/
#include <stdlib.h>
-#include <string.h>
#include <errno.h>
#include <assert.h>
#include <pthread.h>
if (compare == NULL)
return (NULL);
- h = malloc (sizeof (*h));
+ h = calloc (1, sizeof (*h));
if (h == NULL)
return (NULL);
- memset (h, 0, sizeof (*h));
pthread_mutex_init (&h->lock, /* attr = */ NULL);
h->compare = compare;
-
+
h->list = NULL;
h->list_len = 0;
h->list_size = 0;
/* Reorganize the heap from bottom up. */
reheap (h, /* parent of this node = */ (index - 1) / 2, DIR_UP);
-
+
pthread_mutex_unlock (&h->lock);
return (0);
} /* int c_heap_insert */