From c422cddb776985d8159a874a9d30c30abbbf7ac2 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Wed, 16 Mar 2016 11:56:43 -0500 Subject: [PATCH] FS-8946: [mod_xml_cdr] fix segfault on call after loading with no config file or event bind failure causing module load failure --- src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c index 163f7fed0e..1d14051036 100644 --- a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c +++ b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c @@ -502,6 +502,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load) if (switch_event_bind_removable(modname, SWITCH_EVENT_TRAP, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL, &globals.node) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n"); + switch_core_remove_state_handler(&state_handlers); return SWITCH_STATUS_GENERR; } @@ -517,6 +518,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load) /* parse the config */ if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf); + switch_event_unbind(&globals.node); + switch_core_remove_state_handler(&state_handlers); + switch_thread_rwlock_destroy(globals.log_path_lock); return SWITCH_STATUS_FALSE; }