Blob Blame History Raw
autofs-5.0.6 - fix fix LDAP result leaks on error paths

From: Ian Kent <raven@themaw.net>

The previous patch with which ensured that the result struture returned
from ldap_search_s(3) was freed could sometimes lead to a segmentation
fault because the local variable used was not initialized before use.
---

 modules/lookup_ldap.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


--- autofs-5.0.6.orig/modules/lookup_ldap.c
+++ autofs-5.0.6/modules/lookup_ldap.c
@@ -1521,7 +1521,7 @@ int lookup_read_master(struct master *ma
 	char buf[MAX_ERR_BUF];
 	char parse_buf[PARSE_MAX_BUF];
 	char *query;
-	LDAPMessage *result, *e;
+	LDAPMessage *result = NULL, *e;
 	char *class, *info, *entry;
 	char **keyValue = NULL;
 	char **values = NULL;
@@ -2467,7 +2467,7 @@ static int lookup_one(struct autofs_poin
 	char buf[MAX_ERR_BUF];
 	time_t age = time(NULL);
 	char *query;
-	LDAPMessage *result, *e;
+	LDAPMessage *result = NULL, *e;
 	char *class, *info, *entry;
 	char *enc_key1, *enc_key2;
 	int enc_len1 = 0, enc_len2 = 0;