summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7acb8df)
raw | patch | inline | side by side (parent: 7acb8df)
author | Florian Forster <octo@collectd.org> | |
Tue, 2 Sep 2014 17:50:47 +0000 (19:50 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Tue, 2 Sep 2014 17:50:47 +0000 (19:50 +0200) |
src/meta_data.c | patch | blob | history |
diff --git a/src/meta_data.c b/src/meta_data.c
index ea98ba94abf44670583ab47601e39ce6a0f68394..1b5873521c77d1fc7243faa9b6ccf2719674b7b4 100644 (file)
--- a/src/meta_data.c
+++ b/src/meta_data.c
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);