File autofs-5.0.5-fix-ldap-result-leaks.patch of Package autofs
Fix LDAP result leaks on error paths
According to ldap_search_s(3), the result structure must be freed
with ldap_msgfree() even when the search function returned failure.
---
modules/lookup_ldap.c | 6 ++++++
CHANGELOG | 1 +
2 files changed, 7 insertions(+)
Index: autofs/modules/lookup_ldap.c
===================================================================
--- autofs.orig/modules/lookup_ldap.c
+++ autofs/modules/lookup_ldap.c
@@ -347,6 +347,8 @@ static int get_query_dn(unsigned logopt,
error(logopt,
MODPREFIX "query failed for %s: %s",
query, ldap_err2string(rv));
+ if (result)
+ ldap_msgfree(result);
free(query);
return 0;
}
@@ -1573,6 +1575,8 @@ int lookup_read_master(struct master *ma
error(logopt, MODPREFIX "query failed for %s: %s",
query, ldap_err2string(rv));
unbind_ldap_connection(logging, ldap, ctxt);
+ if (result)
+ ldap_msgfree(result);
free(query);
return NSS_STATUS_NOTFOUND;
}
@@ -2586,6 +2590,8 @@ static int lookup_one(struct autofs_poin
if ((rv != LDAP_SUCCESS) || !result) {
crit(ap->logopt, MODPREFIX "query failed for %s", query);
unbind_ldap_connection(ap->logopt, ldap, ctxt);
+ if (result)
+ ldap_msgfree(result);
free(query);
return CHE_FAIL;
}
Index: autofs/CHANGELOG
===================================================================
--- autofs.orig/CHANGELOG
+++ autofs/CHANGELOG
@@ -2,6 +2,7 @@
=======================
- fix ipv6 name for lookup fix.
- fix paged query more results check.
+- fix LDAP result leaks on error paths.
28/06/2011 autofs-5.0.6
-----------------------