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:
parent
6a7821467a
commit
a7bd77944f
1 changed files with 3 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue