]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[mod_kazoo] fix xml leak when event-filter is not available 56/head
authorlazedo <luis.azedo@factorlusitano.com>
Sun, 13 Oct 2019 11:21:22 +0000 (12:21 +0100)
committerGitHub <noreply@github.com>
Sun, 13 Oct 2019 11:21:22 +0000 (12:21 +0100)
src/mod/event_handlers/mod_kazoo/kazoo_ei_utils.c

index c1b792f490b4529806c38de8fec18103d7d11f88..514980b4268fb120f2f57d76e546ec47a11e1951 100644 (file)
@@ -866,7 +866,8 @@ static void fetch_config_filters(switch_memory_pool_t *pool)
 
        if (!(xml = switch_xml_open_cfg(cf, &cfg, params))) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open configuration file %s\n", cf);
-       } else if ((child = switch_xml_child(cfg, "event-filter"))) {
+       } else {
+               if ((child = switch_xml_child(cfg, "event-filter"))) {
                        switch_hash_t *filter;
                        switch_hash_t *old_filter;
 
@@ -881,9 +882,10 @@ static void fetch_config_filters(switch_memory_pool_t *pool)
                        if (old_filter) {
                                switch_core_hash_destroy(&old_filter);
                        }
+               }
 
-                       kazoo_globals.config_fetched = 1;
-                       switch_xml_free(xml);
+               kazoo_globals.config_fetched = 1;
+               switch_xml_free(xml);
        }
 
 }