From 810702c5a71f95fd1cc81a2374917010a3c4be55 Mon Sep 17 00:00:00 2001 From: Falk Werner Date: Sun, 5 Apr 2020 15:09:15 +0200 Subject: [PATCH] fixed memory leak --- lib/webfuse/provider/impl/client.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/webfuse/provider/impl/client.c b/lib/webfuse/provider/impl/client.c index f10450f..9f45a5a 100644 --- a/lib/webfuse/provider/impl/client.c +++ b/lib/webfuse/provider/impl/client.c @@ -43,14 +43,21 @@ struct wfp_client * wfp_impl_client_create( if ((NULL != config->cert_path) && (NULL != config->key_path)) { + client->info.options |= LWS_SERVER_OPTION_EXPLICIT_VHOSTS; + } + + client->context = lws_create_context(&client->info); + + if ((NULL != config->cert_path) && (NULL != config->key_path)) + { + struct lws_vhost * vhost = lws_create_vhost(client->context, &client->info); client->info.options |= LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT; client->info.client_ssl_cert_filepath = config->cert_path; client->info.client_ssl_private_key_filepath = config->key_path; client->info.client_ssl_ca_filepath = config->ca_filepath; + lws_init_vhost_client_ssl(&client->info, vhost); } - client->context = lws_create_context(&client->info); - return client; }