[Core] Fix switch_event_base_add_header leaking memory when headers are with indexes. Add a unit-test.

* [Unit-tests] Add a test provoking switch_event_add_header to memory leak.
* [Core] Fix switch_event_base_add_header leaking memory when headers are with indexes.
This commit is contained in:
Andrey Volk
2021-11-03 17:00:08 +03:00
parent 3c6ffc146f
commit 0fdd5b6727
3 changed files with 22 additions and 0 deletions
+3
View File
@@ -1062,11 +1062,14 @@ static switch_status_t switch_event_base_add_header(switch_event_t *event, switc
exists = 1;
}
FREE(data);
goto redraw;
}
} else if (tmp_header) {
free_header(&tmp_header);
}
FREE(data);
goto end;
} else {
if ((stack & SWITCH_STACK_PUSH) || (stack & SWITCH_STACK_UNSHIFT)) {