Whamcloud - gitweb
mke2fs: fix memory leak when parsing encoding flags
authorTheodore Ts'o <tytso@mit.edu>
Fri, 10 May 2019 18:38:24 +0000 (14:38 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 12 May 2019 06:23:08 +0000 (02:23 -0400)
Also fix extended-options usage string.

Addresses-Coverity-Bug: 1444984
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/mke2fs.c

index 0ba2bf3..d7cf257 100644 (file)
@@ -1102,7 +1102,7 @@ static void parse_extended_opts(struct ext2_super_block *param,
                        "\ttest_fs\n"
                        "\tdiscard\n"
                        "\tnodiscard\n"
-                       "\encoding=<encoding>\n"
+                       "\tencoding=<encoding>\n"
                        "\tencoding_flags=<flags>\n"
                        "\tquotatype=<quota type(s) to be enabled>\n\n"),
                        badopt ? badopt : "");
@@ -2399,6 +2399,7 @@ profile_error:
                                en);
                        exit(1);
                }
+               free(en);
                fs_param.s_encoding = encoding;
                ef = get_string_from_profile(fs_types, "encoding_flags", NULL);
                if (ef) {
@@ -2408,6 +2409,7 @@ profile_error:
                        _("Unknown encoding flags from profile: %s"), ef);
                                exit(1);
                        }
+                       free(ef);
                } else
                        fs_param.s_encoding_flags =
                                e2p_get_encoding_flags(encoding);