From e5c356b2a2de0e6c9d7f5d5af6af5e8f1607a90e Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Sun, 15 Feb 2015 14:25:00 +0000 Subject: [PATCH] ext2fs: Plug small memory leak free() e2fs_contigdirs upon error. Undo zeroing of e2fs_gd as this was actually a false positive. X-MFC with: 278790 --- sys/fs/ext2fs/ext2_vfsops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/fs/ext2fs/ext2_vfsops.c b/sys/fs/ext2fs/ext2_vfsops.c index 386bc238d532..b82a41e41163 100644 --- a/sys/fs/ext2fs/ext2_vfsops.c +++ b/sys/fs/ext2fs/ext2_vfsops.c @@ -363,7 +363,7 @@ compute_sb_data(struct vnode *devvp, struct ext2fs *es, db_count = (fs->e2fs_gcount + e2fs_descpb - 1) / e2fs_descpb; fs->e2fs_gdbcount = db_count; fs->e2fs_gd = malloc(db_count * fs->e2fs_bsize, - M_EXT2MNT, M_WAITOK | M_ZERO); + M_EXT2MNT, M_WAITOK); fs->e2fs_contigdirs = malloc(fs->e2fs_gcount * sizeof(*fs->e2fs_contigdirs), M_EXT2MNT, M_WAITOK | M_ZERO); @@ -379,6 +379,7 @@ compute_sb_data(struct vnode *devvp, struct ext2fs *es, fsbtodb(fs, logic_sb_block + i + 1 ), fs->e2fs_bsize, NOCRED, &bp); if (error) { + free(fs->e2fs_contigdirs, M_EXT2MNT); free(fs->e2fs_gd, M_EXT2MNT); brelse(bp); return (error);