| 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(-) |
| |
| |
| |
| |
| @@ -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) { |
| |
| |
| @@ -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); |
| |