From 1f9305098d4d9b3b56512997ef80ba72390f0aa5 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 5 Jan 2022 01:49:16 +0300 Subject: [PATCH] [mod_xml_ldap] Fix potential memory leaks in xml_ldap_search() --- src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c b/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c index eecdb49549..a28d91a44a 100644 --- a/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c +++ b/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c @@ -721,8 +721,10 @@ static switch_xml_t xml_ldap_search(const char *section, const char *tag_name, c case XML_LDAP_DIRECTORY: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "from cb got %s=%s\n", hi->name, hi->value); if (!strncmp(hi->name, "user", strlen(hi->name))) { + switch_safe_free(dir_exten); dir_exten = strdup(hi->value); } else if (!strncmp(hi->name, "domain", strlen(hi->name))) { + switch_safe_free(dir_domain); dir_domain = strdup(hi->value); } break;