]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
doh regression
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 3 Feb 2011 17:19:24 +0000 (11:19 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 3 Feb 2011 17:19:24 +0000 (11:19 -0600)
src/switch_event.c

index 3e12ea115f31089ffd040027d5b8ec4292121736..b626d5b846c91b799c02fce81c4d16bff6463d2b 100644 (file)
@@ -1561,6 +1561,7 @@ SWITCH_DECLARE(char *) switch_event_expand_headers(switch_event_t *event, const
        char *cloned_sub_val = NULL;
        char *func_val = NULL;
        int nv = 0;
+       char *gvar = NULL;
 
        nv = switch_string_var_check_const(in) || switch_string_has_escaped_data(in);
 
@@ -1673,7 +1674,6 @@ SWITCH_DECLARE(char *) switch_event_expand_headers(switch_event_t *event, const
                                        int offset = 0;
                                        int ooffset = 0;
                                        char *ptr;
-                                       char *gvar = NULL;
 
                                        if ((expanded = switch_event_expand_headers(event, (char *) vname)) == vname) {
                                                expanded = NULL;
@@ -1690,6 +1690,7 @@ SWITCH_DECLARE(char *) switch_event_expand_headers(switch_event_t *event, const
                                        }
 
                                        if (!(sub_val = switch_event_get_header(event, vname))) {
+                                               switch_safe_free(gvar);
                                                if ((gvar = switch_core_get_variable_dup(vname))) {
                                                        sub_val = gvar;
                                                }
@@ -1713,7 +1714,6 @@ SWITCH_DECLARE(char *) switch_event_expand_headers(switch_event_t *event, const
                                                }
                                        }
 
-                                       switch_safe_free(gvar);
                                        switch_safe_free(expanded);
                                } else {
                                        switch_stream_handle_t stream = { 0 };
@@ -1789,6 +1789,7 @@ SWITCH_DECLARE(char *) switch_event_expand_headers(switch_event_t *event, const
                }
        }
        free(indup);
+       switch_safe_free(gvar);
 
        return data;
 }