1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

mqtt: fix memory corruption in MQTT node (closes #237)

This commit is contained in:
Steffen Vogel 2019-03-25 16:01:17 +01:00
parent 40f91ad46a
commit e4de0aad1c

View file

@ -82,12 +82,12 @@ static void mqtt_message_cb(struct mosquitto *mosq, void *userdata, const struct
int ret;
struct node *n = (struct node *) userdata;
struct mqtt *m = (struct mqtt *) n->_vd;
struct sample *smps[n->in.vectorize];
struct sample *smps[n->in.vectorize];
debug(5, "MQTT: Node %s received a message of %d bytes from broker %s", node_name(n), msg->payloadlen, m->host);
ret = sample_alloc_many(&m->pool, smps, n->in.vectorize);
if (ret<0) {
ret = sample_alloc_many(&m->pool, smps, n->in.vectorize);
if (ret <= 0) {
warning("Pool underrun in subscriber of %s", node_name(n));
return;
}