Use -Wall -Werror (AM_CFLAGS) when building any module.
[collectd.git] / src / plugin.c
index 77041c9..4a25aaa 100644 (file)
@@ -716,6 +716,7 @@ int plugin_flush (const char *plugin, int timeout, const char *identifier)
 
     (*callback) (timeout, identifier);
   }
+  return (0);
 } /* int plugin_flush */
 
 void plugin_shutdown_all (void)
@@ -923,7 +924,6 @@ static int plugin_notification_meta_add (notification_t *n,
 
   sstrncpy (meta->name, name, sizeof (meta->name));
   meta->type = type;
-  meta->next = NULL;
 
   switch (type)
   {
@@ -966,6 +966,7 @@ static int plugin_notification_meta_add (notification_t *n,
     }
   } /* switch (type) */
 
+  meta->next = NULL;
   tail = n->meta;
   while ((tail != NULL) && (tail->next != NULL))
     tail = tail->next;
@@ -1018,6 +1019,11 @@ int plugin_notification_meta_copy (notification_t *dst,
 {
   notification_meta_t *meta;
 
+  assert (dst != NULL);
+  assert (src != NULL);
+  assert (dst != src);
+  assert ((src->meta == NULL) || (src->meta != dst->meta));
+
   for (meta = src->meta; meta != NULL; meta = meta->next)
   {
     if (meta->type == NM_TYPE_STRING)
@@ -1059,7 +1065,8 @@ int plugin_notification_meta_free (notification_t *n)
 
     if (this->type == NM_TYPE_STRING)
     {
-      sfree (this->value_string);
+      free ((char *)this->value_string);
+      this->value_string = NULL;
     }
     sfree (this);