X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fmqtt.c;h=8bc412c9497213074a738ca7dfa355209c1872d1;hb=6286127470b83578c2889db546cfa32cb0fe0147;hp=7003fcc63e19b08d775d1c258e058383c3061389;hpb=042c592bcddeea04cf81230ba9c97a09c5d3595c;p=collectd.git diff --git a/src/mqtt.c b/src/mqtt.c index 7003fcc6..8bc412c9 100644 --- a/src/mqtt.c +++ b/src/mqtt.c @@ -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.");