projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'collectd-4.10' into collectd-5.3
[collectd.git]
/
src
/
meta_data.c
diff --git
a/src/meta_data.c
b/src/meta_data.c
index
0192753
..
48dcabc
100644
(file)
--- a/
src/meta_data.c
+++ b/
src/meta_data.c
@@
-313,7
+313,13
@@
int meta_data_toc (meta_data_t *md, char ***toc) /* {{{ */
for (e = md->head; e != NULL; e = e->next)
++count;
for (e = md->head; e != NULL; e = e->next)
++count;
- *toc = malloc(count * sizeof(**toc));
+ if (count == 0)
+ {
+ pthread_mutex_unlock (&md->lock);
+ return (count);
+ }
+
+ *toc = calloc(count, sizeof(**toc));
for (e = md->head; e != NULL; e = e->next)
(*toc)[i++] = strdup(e->key);
for (e = md->head; e != NULL; e = e->next)
(*toc)[i++] = strdup(e->key);