X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fmqtt.c;h=8bc412c9497213074a738ca7dfa355209c1872d1;hb=4825cf6e51535f5c1550bc753bbc2f5161905543;hp=7003fcc63e19b08d775d1c258e058383c3061389;hpb=0c5e4282f0f4e332499feac3b07ce0f29e3d2b1c;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.");