From ff4e684aa375d92bfcc9868f9b79090fb0b44b67 Mon Sep 17 00:00:00 2001 From: "E.Smith" <31170571+azlm8t@users.noreply.github.com> Date: Thu, 11 Jun 2020 14:54:24 +0100 Subject: [PATCH 4/7] hdhomerun: Fix memory leak of access_t. --- src/webui/webui.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/webui/webui.c b/src/webui/webui.c index 5e61ea2ff..3eb4dfe95 100644 --- a/src/webui/webui.c +++ b/src/webui/webui.c @@ -1619,8 +1619,10 @@ hdhomerun_server_discover(http_connection_t *hc, const char *remain, void *opaqu /* We generate a unique deviceid based on the server name */ uint32_t deviceid = tvh_crc32((const uint8_t*)server_name, strlen(server_name), 0); - if (access_verify2(perm, ACCESS_STREAMING)) - return http_noaccess_code(hc); + if (access_verify2(perm, ACCESS_STREAMING)) { + access_destroy(perm); + return http_noaccess_code(hc); + } hq = &hc->hc_reply; tcp_get_str_from_ip(hc->hc_self, http_ip, sizeof(http_ip)); @@ -1643,6 +1645,7 @@ hdhomerun_server_discover(http_connection_t *hc, const char *remain, void *opaqu deviceid, http_ip, tvheadend_webui_port); http_output_content(hc, "application/json"); + access_destroy(perm); return 0; } @@ -1681,8 +1684,10 @@ hdhomerun_server_lineup(http_connection_t *hc, const char *remain, void *opaque) (config.chname_src ? CHANNEL_ENAME_SOURCES : 0); int is_first = 1; - if (access_verify2(perm, ACCESS_STREAMING)) + if (access_verify2(perm, ACCESS_STREAMING)) { + access_destroy(perm); return http_noaccess_code(hc); + } tcp_get_str_from_ip(hc->hc_self, http_ip, sizeof(http_ip)); blank = tvh_gettext_lang(perm->aa_lang_ui, channel_blank_name); @@ -1715,6 +1720,7 @@ hdhomerun_server_lineup(http_connection_t *hc, const char *remain, void *opaque) tvh_mutex_unlock(&global_lock); htsbuf_append_str(hq, "]"); http_output_content(hc, "application/json"); + access_destroy(perm); return 0; } -- 2.25.1