diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2007-09-24 11:28:54 -0400 |
---|---|---|
committer | Neil Brown <neilb@suse.de> | 2007-09-25 11:50:16 +1000 |
commit | 5951bf64c141511632e88693dc92ac77cff025d3 (patch) | |
tree | 661f9af440c00149d8c430dc25dff7f887e0a34e /utils/mount/mount.c | |
parent | 1ca7f42bfa6d4f47c88f82ecc33f2abb3cf92da7 (diff) | |
download | nfs-utils-5951bf64c141511632e88693dc92ac77cff025d3.tar.gz nfs-utils-5951bf64c141511632e88693dc92ac77cff025d3.tar.xz nfs-utils-5951bf64c141511632e88693dc92ac77cff025d3.zip |
mount.nfs: Don't leak mount_opts
A C string containing the user's requested mount options is constructed by
the main mount function in utils/mount/mount.c, but is never freed.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'utils/mount/mount.c')
-rw-r--r-- | utils/mount/mount.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/utils/mount/mount.c b/utils/mount/mount.c index fe2c48b..e622231 100644 --- a/utils/mount/mount.c +++ b/utils/mount/mount.c @@ -470,19 +470,19 @@ int main(int argc, char *argv[]) nfs_error(_("%s: Passing mount options via a" " string is unsupported by this" " kernel\n"), progname); - exit(EX_USAGE); + goto out_usage; } if (uid != 0) { nfs_error(_("%s: -i option is restricted to 'root'\n"), progname); - exit(EX_USAGE); + goto out_usage; } ++string; break; case 'h': default: mount_usage(); - exit(EX_USAGE); + goto out_usage; } } @@ -491,7 +491,7 @@ int main(int argc, char *argv[]) */ if (optind != argc - 2) { mount_usage(); - exit(EX_USAGE); + goto out_usage; } if (strcmp(progname, "mount.nfs4") == 0) @@ -510,7 +510,7 @@ int main(int argc, char *argv[]) strcmp(mc->m.mnt_type, fs_type) != 0) { nfs_error(_("%s: permission denied: no match for %s " "found in /etc/fstab"), progname, mount_point); - exit(EX_USAGE); + goto out_usage; } /* @@ -525,7 +525,7 @@ int main(int argc, char *argv[]) mount_point = canonicalize(mount_point); if (!mount_point) { nfs_error(_("%s: no mount point provided"), progname); - exit(EX_USAGE); + goto out_usage; } if (mount_point[0] != '/') { nfs_error(_("%s: unrecognized mount point %s"), @@ -575,7 +575,12 @@ int main(int argc, char *argv[]) } out: + free(mount_opts); free(extra_opts); free(mount_point); exit(mnt_err); + +out_usage: + free(mount_opts); + exit(EX_USAGE); } |