From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lukasz Majewski Date: Tue, 08 Sep 2015 15:05:25 +0200 Subject: [U-Boot] [PATCH 04/10] ext4: fix leak in check_filename() In-Reply-To: <1441425831-3441-4-git-send-email-swarren@wwwdotorg.org> References: <1441425831-3441-1-git-send-email-swarren@wwwdotorg.org> <1441425831-3441-4-git-send-email-swarren@wwwdotorg.org> Message-ID: <20150908150525.257b1375@amdc2363> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Stephen, > From: Stephen Warren > > root_first_block_buffer should be free()d in all cases, not just when > an error occurs. Fix the success exit path of the function to do this. > > Signed-off-by: Stephen Warren > --- > fs/ext4/ext4_common.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c > index b09f23aa5b83..7d7609a91fa8 100644 > --- a/fs/ext4/ext4_common.c > +++ b/fs/ext4/ext4_common.c > @@ -769,6 +769,7 @@ static int check_filename(char *filename, > unsigned int blknr) struct ext2_dirent *previous_dir = NULL; > char *ptr = NULL; > struct ext_filesystem *fs = get_fs(); > + int ret = -1; > > /* get the first block of root */ > first_block_no_of_root = blknr; > @@ -822,12 +823,12 @@ static int check_filename(char *filename, > unsigned int blknr) if (ext4fs_put_metadata(root_first_block_addr, > first_block_no_of_root)) > goto fail; > - return inodeno; > + ret = inodeno; > } > fail: > free(root_first_block_buffer); > > - return -1; > + return ret; > } > > int ext4fs_filename_check(char *filename) Acked-by: Lukasz Majewski Tested-by: Lukasz Majewski Test HW: Odroid XU3 - Exynos5433 [DFU tests] -- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group