]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: Free splitted optstr's when error occurred
authorNamhyung Kim <namhyung@gmail.com>
Wed, 25 Sep 2013 15:32:04 +0000 (00:32 +0900)
committerKarel Zak <kzak@redhat.com>
Thu, 26 Sep 2013 07:34:56 +0000 (09:34 +0200)
When strdup() failed, u, v and f optstr's should be freed.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
libmount/src/fs.c

index 23c873d541152abfc65571535a4d08cdad666cc5..ebdc44fb90b5040ac02643afdb03fee10c722cf3 100644 (file)
@@ -831,8 +831,12 @@ int mnt_fs_set_options(struct libmnt_fs *fs, const char *optstr)
                if (rc)
                        return rc;
                n = strdup(optstr);
-               if (!n)
+               if (!n) {
+                       free(u);
+                       free(v);
+                       free(f);
                        return -ENOMEM;
+               }
        }
 
        free(fs->fs_optstr);