Ilias Apalodimas ad53505a48 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 <ilias.apalodimas@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-12-06 11:43:28 +01:00
..
2025-11-06 08:30:33 -06:00
2025-04-11 12:16:44 -06:00
2024-07-15 12:12:18 -06:00
2024-07-15 12:12:18 -06:00
2024-07-15 12:12:18 -06:00
2025-04-11 12:16:44 -06:00
2024-07-15 12:12:18 -06:00
2025-07-26 07:34:31 +02:00
2024-07-15 12:12:18 -06:00
2024-10-11 11:44:48 -06:00
2024-07-15 12:12:18 -06:00
2024-07-15 12:12:18 -06:00
2024-07-15 12:12:18 -06:00
2024-07-15 12:12:18 -06:00
2024-07-15 12:12:18 -06:00
2025-02-03 16:01:36 -06:00
2025-07-22 11:29:33 -06:00
2025-02-03 16:01:36 -06:00
2024-12-06 17:47:23 -06:00
2025-04-03 16:54:49 -06:00
2019-12-06 16:44:20 -05:00
2024-12-06 17:47:23 -06:00
2025-01-18 17:12:47 -06:00
2024-12-06 17:47:23 -06:00
2020-08-24 14:11:31 -04:00
2025-02-12 12:37:12 -06:00
2024-11-13 08:14:23 -06:00
2025-01-28 08:58:41 +02:00
2022-01-19 18:11:34 +01:00
2024-10-14 17:58:30 -06:00
2025-04-23 13:19:44 -06:00
2024-11-13 08:16:41 -06:00
2019-05-05 08:48:50 -04:00