Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> --- misc/mke2fs.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 19b6e85..c1cbcaa 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -93,7 +93,7 @@ gid_t root_gid; int journal_size; int journal_flags; int lazy_itable_init; -char *bad_blocks_filename; +char *bad_blocks_filename = NULL; __u32 fs_stride; int quotatype = -1; /* Initialize both user and group quotas by default */ @@ -1139,6 +1139,7 @@ static char **parse_fs_type(const char *fs_type, parse_str = malloc(strlen(usage_types)+1); if (!parse_str) { + free(profile_type); free(list.list); return 0; } @@ -1509,7 +1510,8 @@ profile_error: discard = 0; break; case 'l': - bad_blocks_filename = malloc(strlen(optarg)+1); + bad_blocks_filename = realloc(bad_blocks_filename, + strlen(optarg) + 1); if (!bad_blocks_filename) { com_err(program_name, ENOMEM, _("in malloc for bad_blocks_filename")); @@ -2262,8 +2264,11 @@ static int mke2fs_setup_tdb(const char *name, io_manager *io_ptr) } if (!strcmp(tdb_dir, "none") || (tdb_dir[0] == 0) || - access(tdb_dir, W_OK)) + access(tdb_dir, W_OK)) { + if (free_tdb_dir) + free(tdb_dir); return 0; + } tmp_name = strdup(name); if (!tmp_name) -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html