From 7832b236a42104929c4c8e208888e8110761f7d2 Mon Sep 17 00:00:00 2001 From: Namowen Date: Mon, 20 Feb 2017 06:20:56 +0800 Subject: [PATCH] vhost: also free per-vhost protocols list even when no PLUGINS --- lib/context.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/context.c b/lib/context.c index c72f473..d35b469 100644 --- a/lib/context.c +++ b/lib/context.c @@ -405,8 +405,10 @@ lws_create_vhost(struct lws_context *context, if (info->options & LWS_SERVER_OPTION_EXPLICIT_VHOSTS) vh->protocols = lwsp; - else + else { vh->protocols = info->protocols; + free(lwsp); + } vh->same_vh_protocol_list = (struct lws **) lws_zalloc(sizeof(struct lws *) * vh->count_protocols); @@ -1033,6 +1035,11 @@ lws_context_destroy2(struct lws_context *context) #ifdef LWS_WITH_PLUGINS if (context->plugin_list) lws_free((void *)vh->protocols); +#else + if (vh->options & LWS_SERVER_OPTION_EXPLICIT_VHOSTS) + lws_free((void *)vh->protocols); +#endif +#ifdef LWS_WITH_PLUGINS #ifndef LWS_NO_EXTENSIONS if (context->plugin_extension_count) lws_free((void *)vh->extensions); -- 2.7.4