ldap/servers/slapd/sasl_map.c | 4 ++++
1 file changed, 4 insertions(+)
New commits:
commit 6af5ece3ca029271f2b2180c24bad546e2d64c45
Author: Noriko Hosoi <nhosoi(a)jiji.usersys.redhat.com>
Date: Tue Nov 1 16:03:57 2011 -0700
Bug 750622 - Fix Coverity (11104) Resource leak:
ids_sasl_user_to_entry (slapd/saslbind.c)
https://bugzilla.redhat.com/show_bug.cgi?id=750622
Bug Description: sasl_map_domap allocates strings for "base" and
"filter" in it; the caller ids_sasl_user_to_entry releases them
only when the function returns non-0 regexmatch (matched), but
even if the return value is 0 (did not match), the strings are
allocated.
Fix Description: underlying function sasl_map_check frees "base"
and "filter" if mapping did not match.
diff --git a/ldap/servers/slapd/sasl_map.c b/ldap/servers/slapd/sasl_map.c
index e934b11..1bdaa20 100644
--- a/ldap/servers/slapd/sasl_map.c
+++ b/ldap/servers/slapd/sasl_map.c
@@ -558,6 +558,8 @@ sasl_map_check(sasl_map_data *dp, char *sasl_user_and_realm, char
**ldap_search_
"sasl_map_check: slapi_re_subs failed: "
"subject: %s, subst str: %s (%d)\n",
sasl_user_and_realm, dp->template_base_dn, rc);
+ slapi_ch_free_string(ldap_search_base);
+ slapi_ch_free_string(ldap_search_filter);
} else {
/* Substitutes '&' and/or "\#" in template_search_filter */
rc = slapi_re_subs(re, sasl_user_and_realm,
@@ -568,6 +570,8 @@ sasl_map_check(sasl_map_data *dp, char *sasl_user_and_realm, char
**ldap_search_
"sasl_map_check: slapi_re_subs failed: "
"subject: %s, subst str: %s (%d)\n",
sasl_user_and_realm, dp->template_search_filter, rc);
+ slapi_ch_free_string(ldap_search_base);
+ slapi_ch_free_string(ldap_search_filter);
} else {
/* these values are internal regex representations with
* lots of unprintable control chars - escape for logging */