diff --git a/daemon/lookup.c b/daemon/lookup.c index eac6053..29a1491 100644 --- a/daemon/lookup.c +++ b/daemon/lookup.c @@ -996,8 +996,11 @@ int lookup_prune_cache(struct autofs_point *ap, time_t age) 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) { diff --git a/modules/parse_sun.c b/modules/parse_sun.c index 4241f16..d839694 100644 --- a/modules/parse_sun.c +++ b/modules/parse_sun.c @@ -462,11 +462,17 @@ static char *concat_options(char *left, char *right) 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);