]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
umount: fix memory leak [coverity scan]
authorKarel Zak <kzak@redhat.com>
Thu, 17 Jul 2014 13:12:35 +0000 (15:12 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 17 Jul 2014 13:12:35 +0000 (15:12 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/umount.c

index a75ff9ec19258aa73a4c7feb63cc6ea400abe9d7..8bc6655ea416041aaed5d511f33660edf93bccad 100644 (file)
@@ -445,8 +445,10 @@ static int umount_alltargets(struct libmnt_context *cxt, const char *spec, int r
 
        /* get on @cxt independent mountinfo */
        tb = new_mountinfo(cxt);
-       if (!tb)
-               return MOUNT_EX_SOFTWARE;
+       if (!tb) {
+               rc = MOUNT_EX_SOFTWARE;
+               goto done;
+       }
 
        /* Note that @fs is from mount context and the context will be reseted
         * after each umount() call */
@@ -468,6 +470,7 @@ static int umount_alltargets(struct libmnt_context *cxt, const char *spec, int r
                        break;
        }
 
+done:
        mnt_free_iter(itr);
        mnt_unref_table(tb);