From 6de416d8113d7ccca8e408bb7a3388634ab24e69 Mon Sep 17 00:00:00 2001 From: Andy Green Date: Thu, 8 Aug 2019 21:15:57 +0100 Subject: [PATCH] h2 client: dont leak original user_space for network wsi When creating the stream from the nwsi, the stream was created with its own user_space that gets overwritten with the nwsi one as it is demoted to be the stream. Stop that leaking. --- lib/roles/h2/http2.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/roles/h2/http2.c b/lib/roles/h2/http2.c index 91b6f435e..76449b2ae 100644 --- a/lib/roles/h2/http2.c +++ b/lib/roles/h2/http2.c @@ -1294,6 +1294,8 @@ lws_h2_parse_end_of_frame(struct lws *wsi) h2n->swsi->client_h2_substream = 1; h2n->swsi->protocol = wsi->protocol; + if (h2n->swsi->user_space && !h2n->swsi->user_space_externally_allocated) + lws_free(h2n->swsi->user_space); h2n->swsi->user_space = wsi->user_space; h2n->swsi->user_space_externally_allocated = wsi->user_space_externally_allocated;