Hi, Ian,

It looks like we could end up with a result pointer that is non-null
from a failed call to ldap_search_s.  At least, in my brief look at the
library code it looks like this *might* happen.  So, to be safe, let's
check for that.

Cheers,
Jeff

Signed-off-by: Jeff Moyer <jmo...@redhat.com>

diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
index 2ecf5fe..3a31a8e 100644
--- a/modules/lookup_ldap.c
+++ b/modules/lookup_ldap.c
@@ -390,6 +390,10 @@ static int get_query_dn(unsigned logopt, LDAP *ldap, 
struct lookup_context *ctxt
                                error(logopt,
                                      MODPREFIX "query failed for search dn %s: 
%s",
                                      this->basedn, ldap_err2string(rv));
+                               if (result) {
+                                       ldap_msgfree(result);
+                                       result = NULL;
+                               }
                        }
 
                        this = this->next;

_______________________________________________
autofs mailing list
autofs@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/autofs

Reply via email to