diff --git a/libs/esl/src/esl_event.c b/libs/esl/src/esl_event.c index a953964c3e..e9985d9d6d 100644 --- a/libs/esl/src/esl_event.c +++ b/libs/esl/src/esl_event.c @@ -388,10 +388,6 @@ ESL_DECLARE(int) esl_event_add_array(esl_event_t *event, const char *var, const p += 2; } - if (!max) { - return -2; - } - data = strdup(val + 7); len = (sizeof(char *) * max) + 1; diff --git a/src/switch_event.c b/src/switch_event.c index b93f8746ad..e932a067d5 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -1766,8 +1766,10 @@ SWITCH_DECLARE(switch_xml_t) switch_event_xmlize(switch_event_t *event, const ch ret = vasprintf(&data, fmt, ap); #else data = (char *) malloc(2048); - if (!data) + if (!data) { + va_end(ap); return NULL; + } ret = vsnprintf(data, 2048, fmt, ap); #endif va_end(ap);