]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
mount.nfs: Fix memory leak in nfs_sys_mount()
authorChuck Lever <chuck.lever@oracle.com>
Thu, 28 Oct 2010 17:10:48 +0000 (13:10 -0400)
committerSteve Dickson <steved@redhat.com>
Mon, 1 Nov 2010 12:05:14 +0000 (08:05 -0400)
This appears to have been left behind by last year's adjustments to
how the extra_opts string is constructed.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
utils/mount/stropts.c

index 29b1aaac39cff797e607c0350786687bb303bcb4..ac81616fde125a6820920780d7f7f653816d8cf9 100644 (file)
@@ -568,16 +568,18 @@ static int nfs_sys_mount(struct nfsmount_info *mi, struct mount_options *opts)
        char *options = NULL;
        int result;
 
+       if (mi->fake)
+               return 1;
+
        if (po_join(opts, &options) == PO_FAILED) {
                errno = EIO;
                return 0;
        }
 
-       if (mi->fake)
-               return 1;
-
        result = mount(mi->spec, mi->node, mi->type,
                        mi->flags & ~(MS_USER|MS_USERS), options);
+       free(options);
+
        if (verbose && result) {
                int save = errno;
                nfs_error(_("%s: mount(2): %s"), progname, strerror(save));