projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
daemon: malloc + memset -> calloc
[collectd.git]
/
src
/
daemon
/
utils_heap.c
diff --git
a/src/daemon/utils_heap.c
b/src/daemon/utils_heap.c
index
1b5dca7
..
ae502c9
100644
(file)
--- a/
src/daemon/utils_heap.c
+++ b/
src/daemon/utils_heap.c
@@
-112,14
+112,13
@@
c_heap_t *c_heap_create (int (*compare) (const void *, const void *))
if (compare == NULL)
return (NULL);
if (compare == NULL)
return (NULL);
- h =
malloc (
sizeof (*h));
+ h =
calloc (1,
sizeof (*h));
if (h == NULL)
return (NULL);
if (h == NULL)
return (NULL);
- memset (h, 0, sizeof (*h));
pthread_mutex_init (&h->lock, /* attr = */ NULL);
h->compare = compare;
pthread_mutex_init (&h->lock, /* attr = */ NULL);
h->compare = compare;
-
+
h->list = NULL;
h->list_len = 0;
h->list_size = 0;
h->list = NULL;
h->list_len = 0;
h->list_size = 0;