]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[Core] Fix false-positive memory leak in switch_core_set_variable() detected by scan...
authorAndrey Volk <andywolk@gmail.com>
Mon, 5 Apr 2021 23:23:44 +0000 (02:23 +0300)
committerAndrey Volk <andywolk@gmail.com>
Tue, 19 Oct 2021 17:45:05 +0000 (20:45 +0300)
src/switch_core.c

index 2589d276a4aceb05467026950f24325ac5dd935f..cacff3cdebefd15f28cd7023fb72d42c0aa8671d 100644 (file)
@@ -446,7 +446,8 @@ SWITCH_DECLARE(void) switch_core_set_variable(const char *varname, const char *v
                if (value) {
                        char *v = strdup(value);
                        switch_string_var_check(v, SWITCH_TRUE);
-                       switch_event_add_header_string(runtime.global_vars, SWITCH_STACK_BOTTOM | SWITCH_STACK_NODUP, varname, v);
+                       switch_event_add_header_string(runtime.global_vars, SWITCH_STACK_BOTTOM, varname, v);
+                       free(v);
                } else {
                        switch_event_del_header(runtime.global_vars, varname);
                }