From 8d99ef0686c29a2e07142cc2dcb86d86acc1425e Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 26 Jan 2022 08:07:03 -0500 Subject: [PATCH] TT#14008 use glib allocators for LWS setup Change-Id: I8431d6c9eb1952bffcec03c4715dbcc60b17aff5 --- daemon/websocket.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/daemon/websocket.c b/daemon/websocket.c index fe795c41a..d7afb0ef4 100644 --- a/daemon/websocket.c +++ b/daemon/websocket.c @@ -907,8 +907,8 @@ static void websocket_cleanup(void) { while (websocket_vhost_configs.length) { struct lws_context_creation_info *vhost = g_queue_pop_head(&websocket_vhost_configs); - free((void *) vhost->iface); - free(vhost); + g_free((void *) vhost->iface); + g_slice_free1(sizeof(*vhost), vhost); } } @@ -944,12 +944,12 @@ int websocket_init(void) { if (endpoint_parse_any_getaddrinfo(&ep, ifa)) goto err; - struct lws_context_creation_info *vhost = malloc(sizeof(*vhost)); + struct lws_context_creation_info *vhost = g_slice_alloc(sizeof(*vhost)); g_queue_push_tail(&websocket_vhost_configs, vhost); *vhost = (struct lws_context_creation_info) { .port = ep.port, - .iface = strdup(sockaddr_print_buf(&ep.address)), + .iface = g_strdup(sockaddr_print_buf(&ep.address)), .protocols = websocket_protocols, }; vhost->vhost_name = vhost->iface; @@ -972,12 +972,12 @@ int websocket_init(void) { if (endpoint_parse_any_getaddrinfo(&ep, ifa)) goto err; - struct lws_context_creation_info *vhost = malloc(sizeof(*vhost)); + struct lws_context_creation_info *vhost = g_slice_alloc(sizeof(*vhost)); g_queue_push_tail(&websocket_vhost_configs, vhost); *vhost = (struct lws_context_creation_info) { .port = ep.port, - .iface = strdup(sockaddr_print_buf(&ep.address)), + .iface = g_strdup(sockaddr_print_buf(&ep.address)), .protocols = websocket_protocols, .ssl_cert_filepath = rtpe_config.https_cert, .ssl_private_key_filepath = rtpe_config.https_key ? : rtpe_config.https_cert,