Whamcloud - gitweb
e2fsck: free ctx->fs, not fs, at the end of fsck
authorDarrick J. Wong <darrick.wong@oracle.com>
Fri, 25 Jul 2014 01:03:54 +0000 (21:03 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 25 Jul 2014 01:03:54 +0000 (21:03 -0400)
When we call ext2fs_close_free at the end of main(), we need to supply
the address of ctx->fs, because the subsequent e2fsck_free_context
call will try to access ctx->fs (which is now set to a freed block) to
see if it should free the directory block list.  This is clearly not
desirable, so fix the problem.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/unix.c

index 8d1bdf3..fc05bde 100644 (file)
@@ -1774,7 +1774,7 @@ no_journal:
        io_channel_flush(ctx->fs->io);
        print_resource_track(ctx, NULL, &ctx->global_rtrack, ctx->fs->io);
 
-       ext2fs_close_free(&fs);
+       ext2fs_close_free(&ctx->fs);
        free(ctx->journal_name);
 
        e2fsck_free_context(ctx);