Whamcloud - gitweb
resize2fs: Fix potential memory corruption in ext2fs_progress_init()
authorManish Katiyar <mkatiyar@gmail.com>
Wed, 1 Oct 2008 23:42:57 +0000 (19:42 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 1 Oct 2008 23:42:57 +0000 (19:42 -0400)
Check the return value of ext2fs_get_mem, since prog isn't initialized
so checking may miss a failed memory allocation.

Signed-off-by: Manish Katiyar <mkatiyar@gmail.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
resize/sim_progress.c

index a575633..e7dba88 100644 (file)
@@ -83,7 +83,7 @@ errcode_t ext2fs_progress_init(ext2_sim_progmeter *ret_prog,
        errcode_t               retval;
 
        retval = ext2fs_get_mem(sizeof(struct ext2_sim_progress), &prog);
-       if (!prog)
+       if (retval)
                return retval;
        memset(prog, 0, sizeof(struct ext2_sim_progress));