Merge branch 'collectd-4.10' into collectd-5.3
authorMarc Fournier <marc.fournier@camptocamp.com>
Wed, 22 Apr 2015 06:46:00 +0000 (08:46 +0200)
committerMarc Fournier <marc.fournier@camptocamp.com>
Wed, 22 Apr 2015 06:46:00 +0000 (08:46 +0200)
1  2 
src/meta_data.c

diff --combined src/meta_data.c
@@@ -313,13 -313,7 +313,13 @@@ int meta_data_toc (meta_data_t *md, cha
    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);
    
@@@ -489,7 -483,7 +489,7 @@@ int meta_data_get_string (meta_data_t *
  
    if (e->type != MD_TYPE_STRING)
    {
-     ERROR ("meta_data_get_signed_int: Type mismatch for key `%s'", e->key);
+     ERROR ("meta_data_get_string: Type mismatch for key `%s'", e->key);
      pthread_mutex_unlock (&md->lock);
      return (-ENOENT);
    }