mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-19 03:15:00 +00:00
ext4: avoid calling ext4fs_mount() twice, which leaks
ext4_write_file() is only called from the "fs" layer, which calls both ext4fs_mount() and ext4fs_close() before/after calling ext4_write_file(). Fix ext4_write_file() not to call ext4fs_mount() again, since the mount operation malloc()s some RAM which is leaked when a second mount call over-writes the pointer to that data, if no intervening close call is made. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Lukasz Majewski <l.majewski@samsung.com> Tested-by: Lukasz Majewski <l.majewski@samsung.com>
This commit is contained in:
parent
44bfb43f9a
commit
676505f5ce
1 changed files with 0 additions and 9 deletions
|
@ -987,26 +987,17 @@ int ext4_write_file(const char *filename, void *buf, loff_t offset,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* mount the filesystem */
|
|
||||||
if (!ext4fs_mount(0)) {
|
|
||||||
printf("** Error Bad ext4 partition **\n");
|
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = ext4fs_write(filename, buf, len);
|
ret = ext4fs_write(filename, buf, len);
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
printf("** Error ext4fs_write() **\n");
|
printf("** Error ext4fs_write() **\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
ext4fs_close();
|
|
||||||
|
|
||||||
*actwrite = len;
|
*actwrite = len;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
ext4fs_close();
|
|
||||||
*actwrite = 0;
|
*actwrite = 0;
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue