resize2fs: Fix potential memory corruption in ext2fs_progress_init()
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>
diff --git a/resize/sim_progress.c b/resize/sim_progress.c
index a575633..e7dba88 100644
--- a/resize/sim_progress.c
+++ b/resize/sim_progress.c
@@ -83,7 +83,7 @@
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));