diff options
| author | Ilias Apalodimas <[email protected]> | 2025-11-27 14:19:06 +0200 |
|---|---|---|
| committer | Heinrich Schuchardt <[email protected]> | 2025-12-06 11:43:28 +0100 |
| commit | ad53505a4861ad7eec5c6a919ea39692d915e433 (patch) | |
| tree | d717e1b0537a915b6a100ee0ab18d73caca417d1 /scripts/cleanpatch | |
| parent | 18e2a059ff3f04e21cf2f17af59d2c812cebc517 (diff) | |
efi_loader: Fix a memory leak when retrieving device paths from boot vars
get_dp_device() is used to derive the device path from a boot variable.
However, if the last efi_get_variable_int() call fails, we return an
error without freeing 'buf'.
There's no need to call efi_get_variable_int() for variables we don't
know the size since we have the efi_get_var() wrapper.
Replace that in the two instances we use it. The first one will also
fix the memory leak.
A nice sideeffect is that the code size is also reduced, since we are
re-using functions instead of open coding them
$~ bloat-o-meter u-boot u-boot.new
add/remove: 0/0 grow/shrink: 1/2 up/down: 6/-196 (-190)
Function old new delta
version_string 70 76 +6
efi_launch_capsules 2288 2196 -92
get_dp_device 244 140 -104
Total: Before=1222331, After=1222141, chg -0.02%
Fixes: c74cd8bd08d1 ("efi_loader: capsule: add capsule_on_disk support")
Signed-off-by: Ilias Apalodimas <[email protected]>
Reviewed-by: Heinrich Schuchardt <[email protected]>
Diffstat (limited to 'scripts/cleanpatch')
0 files changed, 0 insertions, 0 deletions
