Browse Source

TT#14008 use glib allocators for LWS setup

Change-Id: I8431d6c9eb1952bffcec03c4715dbcc60b17aff5
pull/1439/head
Richard Fuchs 4 years ago
parent
commit
8d99ef0686
1 changed files with 6 additions and 6 deletions
  1. +6
    -6
      daemon/websocket.c

+ 6
- 6
daemon/websocket.c View File

@ -907,8 +907,8 @@ static void websocket_cleanup(void) {
while (websocket_vhost_configs.length) { while (websocket_vhost_configs.length) {
struct lws_context_creation_info *vhost = g_queue_pop_head(&websocket_vhost_configs); 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)) if (endpoint_parse_any_getaddrinfo(&ep, ifa))
goto err; 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); g_queue_push_tail(&websocket_vhost_configs, vhost);
*vhost = (struct lws_context_creation_info) { *vhost = (struct lws_context_creation_info) {
.port = ep.port, .port = ep.port,
.iface = strdup(sockaddr_print_buf(&ep.address)),
.iface = g_strdup(sockaddr_print_buf(&ep.address)),
.protocols = websocket_protocols, .protocols = websocket_protocols,
}; };
vhost->vhost_name = vhost->iface; vhost->vhost_name = vhost->iface;
@ -972,12 +972,12 @@ int websocket_init(void) {
if (endpoint_parse_any_getaddrinfo(&ep, ifa)) if (endpoint_parse_any_getaddrinfo(&ep, ifa))
goto err; 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); g_queue_push_tail(&websocket_vhost_configs, vhost);
*vhost = (struct lws_context_creation_info) { *vhost = (struct lws_context_creation_info) {
.port = ep.port, .port = ep.port,
.iface = strdup(sockaddr_print_buf(&ep.address)),
.iface = g_strdup(sockaddr_print_buf(&ep.address)),
.protocols = websocket_protocols, .protocols = websocket_protocols,
.ssl_cert_filepath = rtpe_config.https_cert, .ssl_cert_filepath = rtpe_config.https_cert,
.ssl_private_key_filepath = rtpe_config.https_key ? : rtpe_config.https_cert, .ssl_private_key_filepath = rtpe_config.https_key ? : rtpe_config.https_cert,


Loading…
Cancel
Save