From 4d1eef4f496f166f82504bc4920599029a70869c Mon Sep 17 00:00:00 2001 From: Nathan Moinvaziri Date: Thu, 30 Nov 2023 13:34:58 -0800 Subject: [PATCH] Fixed possible heap-after-free when reusing proxyres. --- config.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config.c b/config.c index f322fde..ef9d1e0 100644 --- a/config.c +++ b/config.c @@ -131,10 +131,14 @@ bool proxy_config_global_init(void) { bool proxy_config_global_cleanup(void) { if (--g_proxy_config.ref_count > 0) return true; + free(g_proxy_config.auto_config_url); free(g_proxy_config.proxy); free(g_proxy_config.bypass_list); + if (g_proxy_config.proxy_config_i) - return g_proxy_config.proxy_config_i->global_cleanup(); + g_proxy_config.proxy_config_i->global_cleanup(); + + memset(&g_proxy_config, 0, sizeof(g_proxy_config)); return false; }