autofs-5.0.3 - fix a couple of memory leaks From: Ian Kent --- CHANGELOG | 2 ++ daemon/lookup.c | 5 ++++- modules/parse_sun.c | 14 ++++++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 82b080c..5901c75 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -21,6 +21,8 @@ - additional fix incorrect pthreads condition handling for mount requests. - allow mount point directory creation for clients with an NFS root. - fix direct mount path length not being checked. +- fix incorrect if check in get user info. +- fix couple of memory leaks. 14/01/2008 autofs-5.0.3 ----------------------- 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);