From 269db09015fc44adb49beaa40d7003b84be4afdd Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Fri, 16 May 2014 14:50:18 +0000 Subject: [PATCH] don't leak on xferext ivr event, CID:1214232 Resource leak --- src/switch_ivr.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/switch_ivr.c b/src/switch_ivr.c index db43e6a7bd..ef4707b561 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -696,13 +696,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se if (!strcasecmp(hp->name, "application")) { app = strdup(hp->value); - data = strchr(app, ' '); - - if (data) { - *data++ = '\0'; + if (app) { + data = strchr(app, ' '); + + if (data) { + *data++ = '\0'; + } + + switch_caller_extension_add_application(session, extension, app, data); + free(app); } - - switch_caller_extension_add_application(session, extension, app, data); } }