From: Darrick J. Wong Date: Sun, 3 Aug 2014 02:18:29 +0000 (-0400) Subject: e2fuzz: fix fs handle cleanup when closing fails X-Git-Tag: v1.43-WIP-2015-05-18~266 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8375a881f905be4ee66db24e111b3a70947a12ec;p=thirdparty%2Fe2fsprogs.git e2fuzz: fix fs handle cleanup when closing fails Fix the handling of 'fs' when closing the FS fails so that we don't dereference a NULL pointer. Adapt to use ext2fs_close_free while we're at it. Signed-off-by: Darrick J. Wong Fixes-Coverity-Bug: 1229241 Signed-off-by: Theodore Ts'o --- diff --git a/misc/e2fuzz.c b/misc/e2fuzz.c index 644c9c537..8c989ddc9 100644 --- a/misc/e2fuzz.c +++ b/misc/e2fuzz.c @@ -279,23 +279,20 @@ int process_fs(const char *fsname) close(fd); /* Clean up */ - ret = ext2fs_close(fs); + ret = ext2fs_close_free(&fs); if (ret) { - fs = NULL; fprintf(stderr, "%s: error while closing filesystem\n", fsname); - goto fail2; + return 1; } return 0; fail3: close(fd); -fail2: if (corrupt_map != fs->block_map) ext2fs_free_block_bitmap(corrupt_map); fail: - if (fs) - ext2fs_close(fs); + ext2fs_close_free(&fs); return 1; }