Merge branch 'collectd-5.5'
[collectd.git] / src / mqtt.c
index 7003fcc..8bc412c 100644 (file)
@@ -221,6 +221,7 @@ static void on_message (
     if (payload == NULL)
     {
         ERROR ("mqtt plugin: malloc for payload buffer failed.");
+        sfree (vl.values);
         return;
     }
     memmove (payload, msg->payload, msg->payloadlen);
@@ -728,7 +729,7 @@ static int mqtt_config_subscriber (oconfig_item_t *ci)
             ERROR ("mqtt plugin: Unknown config option: %s", child->key);
     }
 
-    tmp = realloc (subscribers, sizeof (*subscribers) * subscribers_num);
+    tmp = realloc (subscribers, sizeof (*subscribers) * (subscribers_num + 1) );
     if (tmp == NULL)
     {
         ERROR ("mqtt plugin: realloc failed.");