From 1f2c2f35d34c4da42afa803fd16687b8bed27162 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 1 Aug 2014 05:37:05 -0400 Subject: [PATCH 17/22] Don't leak memory in remove_from_boot_order() Signed-off-by: Peter Jones --- src/efibootmgr/efibootmgr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/efibootmgr/efibootmgr.c b/src/efibootmgr/efibootmgr.c index 0d7224a..d3448da 100644 --- a/src/efibootmgr/efibootmgr.c +++ b/src/efibootmgr/efibootmgr.c @@ -381,8 +381,10 @@ remove_from_boot_order(uint16_t num) boot_order->data = (uint8_t *)new_data; boot_order->data_size = new_data_size; efi_del_variable(EFI_GLOBAL_GUID, "BootOrder"); - return efi_set_variable(EFI_GLOBAL_GUID, "BootOrder", boot_order->data, + rc = efi_set_variable(EFI_GLOBAL_GUID, "BootOrder", boot_order->data, boot_order->data_size, boot_order->attributes); + free(boot_order->data); + return rc; } static int -- 1.9.3