stream-ws: Clean up exec-and-send resources

rsa-aes
Andri Yngvason 2023-09-03 18:37:23 +00:00
parent 83ed3273ce
commit abf9cc54c0
1 changed files with 5 additions and 0 deletions

View File

@ -256,6 +256,10 @@ static struct rcbuf* stream_ws_chained_exec(struct stream* tcp_stream,
struct rcbuf* buf = ctx->exec(&ws->base, ctx->userdata); struct rcbuf* buf = ctx->exec(&ws->base, ctx->userdata);
// TODO: This also needs to be cleaned it it's left on the send queue
// when the stream is destroyed.
free(ctx->userdata);
struct vec out; struct vec out;
vec_init(&out, WS_HEADER_MIN_SIZE + buf->size + 1); vec_init(&out, WS_HEADER_MIN_SIZE + buf->size + 1);
@ -268,6 +272,7 @@ static struct rcbuf* stream_ws_chained_exec(struct stream* tcp_stream,
out.len += head_len; out.len += head_len;
vec_append(&out, buf->payload, buf->size); vec_append(&out, buf->payload, buf->size);
rcbuf_unref(buf);
return rcbuf_new(out.data, out.len); return rcbuf_new(out.data, out.len);
} }