diff options
author | Stephen Warren <swarren@nvidia.com> | 2015-09-04 22:03:45 -0600 |
---|---|---|
committer | Dongjin Kim <tobetter@gmail.com> | 2020-02-10 22:44:41 +0900 |
commit | 9732cd897daff5dc4a50510a44489fa47f304aa6 (patch) | |
tree | d9ebb6e7a734bd2307be4deb97aa4f80e6bd0669 | |
parent | c1118c53cbe94ee461b85c7f593bd1952b16d189 (diff) | |
download | u-boot-odroid-c1-9732cd897daff5dc4a50510a44489fa47f304aa6.tar.gz |
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>
-rw-r--r-- | fs/ext4/ext4_common.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c index 0cbfd75566..7d10009547 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) |