CID:1214211 Resource leak

This commit is contained in:
Michael Jerris 2014-05-15 13:58:08 +00:00
parent 0469db0305
commit d2884ac5a6
1 changed files with 16 additions and 11 deletions

View File

@ -501,18 +501,23 @@ SWITCH_STANDARD_CHAT_APP(set_function)
{
char *var, *val;
if (data) {
var = strdup(data);
if ((val = strchr(var, '='))) {
*val++ = '\0';
}
if (zstr(val)) {
switch_event_del_header(message, var);
} else {
switch_event_add_header_string(message, SWITCH_STACK_BOTTOM, var, val);
}
if (!data) return SWITCH_STATUS_SUCCESS;
var = strdup(data);
if (!var) return SWITCH_STATUS_SUCCESS;
if ((val = strchr(var, '='))) {
*val++ = '\0';
}
if (zstr(val)) {
switch_event_del_header(message, var);
} else {
switch_event_add_header_string(message, SWITCH_STACK_BOTTOM, var, val);
}
free(var);
return SWITCH_STATUS_SUCCESS;
}