summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2015-09-04 22:03:45 -0600
committerTom Rini <trini@konsulko.com>2015-09-11 17:15:23 -0400
commitd56b2015e6d5695d009d8e5e3930cbf34c3b5da0 (patch)
tree1f0bd35221f5d2c16165f2d36e9d9f0ea706abdf /fs
parent934b14f2bb306dfa1947d30f4df90cdc8b710332 (diff)
downloadu-boot-imx-d56b2015e6d5695d009d8e5e3930cbf34c3b5da0.zip
u-boot-imx-d56b2015e6d5695d009d8e5e3930cbf34c3b5da0.tar.gz
u-boot-imx-d56b2015e6d5695d009d8e5e3930cbf34c3b5da0.tar.bz2
ext4: fix leak in check_filename()
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 <swarren@nvidia.com> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/ext4_common.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c
index 9fdbfe6..410419e 100644
--- a/fs/ext4/ext4_common.c
+++ b/fs/ext4/ext4_common.c
@@ -770,6 +770,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;
@@ -823,12 +824,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)