37 lines
977 B
Diff
37 lines
977 B
Diff
autofs-5.1.0 - fix leak in parse_mount()
|
|
|
|
From: Ian Kent <ikent@redhat.com>
|
|
|
|
Fix a potential memory leak of the allocated mount location
|
|
in modules/parse_sun.c:parse_mount().
|
|
---
|
|
modules/parse_sun.c | 8 ++++++--
|
|
1 file changed, 6 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/modules/parse_sun.c b/modules/parse_sun.c
|
|
index 1fdea0b..b881ee9 100644
|
|
--- a/modules/parse_sun.c
|
|
+++ b/modules/parse_sun.c
|
|
@@ -1567,7 +1567,10 @@ int parse_mount(struct autofs_point *ap, const char *name,
|
|
*/
|
|
if ((strstr(options, "fstype=autofs") &&
|
|
strstr(options, "hosts"))) {
|
|
- loc = NULL;
|
|
+ if (loc) {
|
|
+ free(loc);
|
|
+ loc = NULL;
|
|
+ }
|
|
loclen = 0;
|
|
} else {
|
|
loclen = strlen(loc);
|
|
@@ -1591,7 +1594,8 @@ int parse_mount(struct autofs_point *ap, const char *name,
|
|
rv = sun_mount(ap, ap->path, name, name_len,
|
|
loc, loclen, options, ctxt);
|
|
|
|
- free(loc);
|
|
+ if (loc)
|
|
+ free(loc);
|
|
free(options);
|
|
pthread_setcancelstate(cur_state, NULL);
|
|
}
|