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

websocket: fix possible segmention fault

This commit is contained in:
Steffen Vogel 2018-05-26 01:12:00 +02:00
parent 6a7821467a
commit a7bd77944f

View file

@ -290,8 +290,10 @@ int websocket_protocol_cb(struct lws *wsi, enum lws_callback_reasons reason, voi
int avail, enqueued;
struct websocket *w = (struct websocket *) n->_vd;
struct sample **smps = alloca(cnt * sizeof(struct sample *));
if (!smps)
if (!smps) {
warn("Failed to allocate memory for connection: %s", websocket_connection_name(c));
break;
}
avail = sample_alloc_many(&w->pool, smps, cnt);
if (avail < cnt)