From cc8a8c519843d24723e2d25dacd2f926ece1c742 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Tue, 14 Jan 2014 09:34:20 -0500 Subject: [PATCH] FS-6095 --resolve modified to protect against memory leak and make it more consistant with other modules --- .../applications/mod_callcenter/mod_callcenter.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 07449411f0..ab386f8ecd 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -661,11 +661,17 @@ static cc_queue_t *load_queue(const char *queue_name) cc_queue_t *queue = NULL; switch_xml_t x_queues, x_queue, cfg, xml; switch_event_t *event = NULL; + switch_event_t *params = NULL; - if (!(xml = switch_xml_open_cfg(global_cf, &cfg, NULL))) { + switch_event_create(¶ms, SWITCH_EVENT_REQUEST_PARAMS); + switch_assert(params); + switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "CC-Queue", queue_name); + + if (!(xml = switch_xml_open_cfg(global_cf, &cfg, params))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", global_cf); - return queue; + goto end; } + if (!(x_queues = switch_xml_child(cfg, "queues"))) { goto end; } @@ -717,6 +723,9 @@ end: if (event) { switch_event_destroy(&event); } + if (params) { + switch_event_destroy(¶ms); + } return queue; }