e2fsprogs/debugfs
Lukas Czerner 47fee2ef6a e2fsprogs: introduce ext2fs_close_free() helper
Currently there are many uses of ext2fs_close() which might be wrong.
First of all ext2fs_close() does not set the ext2_filsys pointer to NULL
so the caller is responsible for clearing it, however there are some
cases there we do not do it.

Second of all very small number of users of ext2fs_close() actually
check the return value. If there is a problem in ext2fs_close() it will
not even free the ext2_filsys structure, but majority of users expect it
to do so.

To fix both problems this commit introduces a new helper
ext2fs_close_free() which will not only check for the return value and
free the ext2_filsys structure if the call to ext2fs_close2() failed,
but it will also set the ext2_filsys pointer to NULL.

Replace every use of ext2fs_close() in e2fsprogs tools with
ext2fs_close_free() - there is no real reason to keep using
ext2fs_close().

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
2014-07-05 21:06:48 -04:00
..
debug_cmds.ct debugfs: add commands to query the quota information 2014-05-13 10:13:19 -04:00
debugfs.8.in debugfs: document the lsdel command in the man page 2013-12-28 22:15:59 -05:00
debugfs.c e2fsprogs: introduce ext2fs_close_free() helper 2014-07-05 21:06:48 -04:00
debugfs.h debugfs: add commands to query the quota information 2014-05-13 10:13:19 -04:00
dump.c debugfs: don't leak fd when calling dump_file 2013-12-12 12:51:01 -05:00
extent_cmds.ct debugfs: add the ability to manipulate the extent tree directly 2012-12-24 10:49:41 -05:00
extent_inode.c debugfs: restore and tweak original error messaging 2013-12-30 16:56:19 -05:00
filefrag.c debugfs: update usage message for open and filefrag 2013-12-08 21:06:40 -05:00
htree.c Fix gcc -Wall nits 2013-01-01 13:28:27 -05:00
icheck.c debugfs: restore and tweak original error messaging 2013-12-30 16:56:19 -05:00
jfs_user.h Move linux/jbd.h to ext2fs/kernel-jbd.h, to avoid using the 2001-12-23 19:33:51 -05:00
logdump.c debugfs: clean up read_journal_block() to avoid Coverity complaint 2014-01-04 19:11:37 -05:00
ls.c debugfs: initialize inode to 0 in list_dir_proc() if no inode nr 2011-09-25 01:55:28 -04:00
lsdel.c debugfs: clean up debugfs man page and help text 2013-12-15 22:13:15 -05:00
Makefile.in debugfs: add commands to query the quota information 2014-05-13 10:13:19 -04:00
ncheck.c debugfs: fix spelling typo in ncheck 2012-01-23 11:33:33 -05:00
quota.c debugfs: fix debugfs/quota.c compile warnings 2014-05-22 17:57:21 -04:00
ro_debug_cmds.ct debugfs: add commands to query the quota information 2014-05-13 10:13:19 -04:00
set_fields.c debugfs: add support setting the error_count and associated sb fields 2014-07-04 16:39:49 -04:00
unused.c Shorten compile commands run by the build system 2011-09-18 17:34:37 -04:00
util.c debugfs: fix string_to_time for MacOS strptime() 2014-05-22 17:52:23 -04:00
zap.c debugfs: clean up debugfs man page and help text 2013-12-15 22:13:15 -05:00