debugfs: Close the file handle and return in case of errors
Close the filehandle and return in case if we are unable to expand the
directory during write.
Signed-off-by: "Manish Katiyar" <mkatiyar@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
index 7039340..ab40de8 100644
--- a/debugfs/debugfs.c
+++ b/debugfs/debugfs.c
@@ -1366,6 +1366,7 @@
retval = ext2fs_expand_dir(current_fs, cwd);
if (retval) {
com_err(argv[0], retval, "while expanding directory");
+ close(fd);
return;
}
retval = ext2fs_link(current_fs, cwd, argv[2], newfile,