diff --git a/src/meta_data.c b/src/meta_data.c
index fb9b3d47d67c3a39cc79eb4400795b0df5792627..d3da9bb5800bc776c1b509c31a6f0225300661c4 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);