From: Theodore Ts'o Date: Mon, 25 Jul 2005 16:36:43 +0000 (-0500) Subject: Fix use-after-free bug of e2fsck context structure. X-Git-Tag: E2FSPROGS-1.39-WIP-1210~41 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=b28a6e96af53338c303e0f25e28ea02705a1d680;p=tools%2Fe2fsprogs.git Fix use-after-free bug of e2fsck context structure. Signed-off-by: "Theodore Ts'o" --- diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index 53cbbb0..deec7ea 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,5 +1,8 @@ 2005-07-25 Theodore Ts'o + * unix.c (main): Fix a use-after-free bug of the e2fsck context + structure at the very end of the e2fsck run. + * pass1.c (pass1_write_inode): Fix false positive from valgrind; don't do a needless structure copy via an assignment when it is a no-op. diff --git a/e2fsck/unix.c b/e2fsck/unix.c index 1d74929..6cbcb10 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -1168,12 +1168,11 @@ restart: ctx->fs = NULL; free(ctx->filesystem_name); free(ctx->journal_name); - e2fsck_free_context(ctx); - + #ifdef RESOURCE_TRACK if (ctx->options & E2F_OPT_TIME) print_resource_track(NULL, &ctx->global_rtrack); #endif - + e2fsck_free_context(ctx); return exit_value; }