[PATCH 07/15] libext2fs: fix error path in ext2fs_update_bb_inode()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If ext2fs_get_mem() on rec.block_buf fails we should not call
ext2fs_free_mem() on it.

Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxx>
---
 lib/ext2fs/bb_inode.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/ext2fs/bb_inode.c b/lib/ext2fs/bb_inode.c
index 0b79b16..9576be2 100644
--- a/lib/ext2fs/bb_inode.c
+++ b/lib/ext2fs/bb_inode.c
@@ -74,8 +74,10 @@ errcode_t ext2fs_update_bb_inode(ext2_filsys fs, ext2_badblocks_list bb_list)
 		return retval;
 	memset(rec.ind_blocks, 0, rec.max_ind_blocks * sizeof(blk_t));
 	retval = ext2fs_get_mem(fs->blocksize, &rec.block_buf);
-	if (retval)
-		goto cleanup;
+	if (retval) {
+		ext2fs_free_mem(&rec.ind_blocks);
+		return retval;
+	}
 	memset(rec.block_buf, 0, fs->blocksize);
 	rec.err = 0;
 
-- 
1.7.0.4

--
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


[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux