Blob Blame History Raw
autofs-5.0.3 - fix a couple of memory leaks

From: Ian Kent <raven@themaw.net>


---

 daemon/lookup.c     |    5 ++++-
 modules/parse_sun.c |   14 ++++++++++----
 2 files changed, 14 insertions(+), 5 deletions(-)


--- autofs-5.0.2.orig/daemon/lookup.c
+++ autofs-5.0.2/daemon/lookup.c
@@ -996,8 +996,11 @@ int lookup_prune_cache(struct autofs_poi
 
 			key = strdup(me->key);
 			me = cache_enumerate(mc, me);
-			if (!key || *key == '*')
+			if (!key || *key == '*') {
+				if (key)
+					free(key);
 				continue;
+			}
 
 			path = make_fullpath(ap->path, key);
 			if (!path) {
--- autofs-5.0.2.orig/modules/parse_sun.c
+++ autofs-5.0.2/modules/parse_sun.c
@@ -462,11 +462,17 @@ static char *concat_options(char *left, 
 	char buf[MAX_ERR_BUF];
 	char *ret;
 
-	if (left == NULL || *left == '\0')
-		return strdup(right);
+	if (left == NULL || *left == '\0') {
+		ret = strdup(right);
+		free(right);
+		return ret;
+	}
 
-	if (right == NULL || *right == '\0')
-		return strdup(left);
+	if (right == NULL || *right == '\0') {
+		ret = strdup(left);
+		free(left);
+		return ret;
+	}
 
 	ret = malloc(strlen(left) + strlen(right) + 2);