mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-18 02:44:37 +00:00
fs: ext4: free directory node in ext4fs_exists()
The directory retrieved in ext4fs_exists() should be freed to avoid a memory leak. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com> Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
This commit is contained in:
parent
a1a86a1784
commit
2d94480c02
1 changed files with 7 additions and 2 deletions
|
@ -209,12 +209,17 @@ int ext4fs_exists(const char *filename)
|
|||
{
|
||||
struct ext2fs_node *dirnode = NULL;
|
||||
int filetype;
|
||||
int ret;
|
||||
|
||||
if (!filename)
|
||||
return 0;
|
||||
|
||||
return ext4fs_find_file1(filename, &ext4fs_root->diropen, &dirnode,
|
||||
&filetype);
|
||||
ret = ext4fs_find_file1(filename, &ext4fs_root->diropen, &dirnode,
|
||||
&filetype);
|
||||
if (dirnode)
|
||||
ext4fs_free_node(dirnode, &ext4fs_root->diropen);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int ext4fs_size(const char *filename, loff_t *size)
|
||||
|
|
Loading…
Add table
Reference in a new issue