Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx> --- misc/e2image.c | 1 + misc/filefrag.c | 2 ++ resize/online.c | 12 +++++++++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/misc/e2image.c b/misc/e2image.c index 25d8d4e..624525b 100644 --- a/misc/e2image.c +++ b/misc/e2image.c @@ -1227,6 +1227,7 @@ static void install_image(char *device, char *image_fn, int type) exit(1); } + close(fd); ext2fs_close (fs); } diff --git a/misc/filefrag.c b/misc/filefrag.c index 35b3544..a050a22 100644 --- a/misc/filefrag.c +++ b/misc/filefrag.c @@ -360,12 +360,14 @@ static void frag_report(const char *filename) #else if (fstat(fd, &st) < 0) { #endif + close(fd); perror("stat"); return; } if (last_device != st.st_dev) { if (fstatfs(fd, &fsinfo) < 0) { + close(fd); perror("fstatfs"); return; } diff --git a/resize/online.c b/resize/online.c index 2d34640..defcac1 100644 --- a/resize/online.c +++ b/resize/online.c @@ -184,12 +184,16 @@ errcode_t online_resize_fs(ext2_filsys fs, const char *mtpt, ext2fs_blocks_count(sb); retval = ext2fs_read_bitmaps(fs); - if (retval) + if (retval) { + close(fd); return retval; + } retval = ext2fs_dup_handle(fs, &new_fs); - if (retval) + if (retval) { + close(fd); return retval; + } /* The current method of adding one block group at a time to a * mounted filesystem means it is impossible to accomodate the @@ -203,8 +207,10 @@ errcode_t online_resize_fs(ext2_filsys fs, const char *mtpt, */ new_fs->super->s_feature_incompat &= ~EXT4_FEATURE_INCOMPAT_FLEX_BG; retval = adjust_fs_info(new_fs, fs, 0, *new_size); - if (retval) + if (retval) { + close(fd); return retval; + } printf(_("Performing an on-line resize of %s to %llu (%dk) blocks.\n"), fs->device_name, *new_size, fs->blocksize / 1024); -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html