From 30d5ecf9f7ec7344f0a82869c170f4ec489b12cf Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 10 Jul 2013 10:26:08 -0500 Subject: [PATCH] FS-5445 --resolve this was actually just missing one word from the code as seen in the similar code in the core, the same mistake was made there where the compiler is not smart enough to see the mutually exclusive logical paths this code is specific to spontaneously creating an array in a single set like set foo[12]=val which would be totally broken if that line were commented --- libs/esl/src/esl_event.c | 2 +- src/switch_event.c | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/libs/esl/src/esl_event.c b/libs/esl/src/esl_event.c index 19cb6708a5..910180f47e 100644 --- a/libs/esl/src/esl_event.c +++ b/libs/esl/src/esl_event.c @@ -445,7 +445,7 @@ static esl_status_t esl_event_base_add_header(esl_event_t *event, esl_stack_t st fly++; } - if ((header = esl_event_get_header_ptr(event, header_name))) { + if (header || (header = esl_event_get_header_ptr(event, header_name))) { if (index_ptr) { if (index > -1 && index <= 4000) { diff --git a/src/switch_event.c b/src/switch_event.c index de875b6337..20262677e1 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -916,11 +916,9 @@ static switch_status_t switch_event_base_add_header(switch_event_t *event, switc if (index_ptr || (stack & SWITCH_STACK_PUSH) || (stack & SWITCH_STACK_UNSHIFT)) { if (!(header = switch_event_get_header_ptr(event, header_name)) && index_ptr) { - /* - * Removing a possible leak. But it doesn't appear this is used anywhere, and even if it were then it wouldn't be working. - header = new_header(header_name); - */ - + + header = new_header(header_name); + if (switch_test_flag(event, EF_UNIQ_HEADERS)) { switch_event_del_header(event, header_name); }