From 93b5fca09593dc94e14507814b4ee360b8f1abef Mon Sep 17 00:00:00 2001 From: Lucas Stach Date: Wed, 2 Mar 2016 21:50:33 +0100 Subject: efi: fix memory leak in error path Signed-off-by: Lucas Stach Signed-off-by: Sascha Hauer --- arch/efi/efi/efi-device.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'arch/efi') diff --git a/arch/efi/efi/efi-device.c b/arch/efi/efi/efi-device.c index 7db8e48f7b..678a28399d 100644 --- a/arch/efi/efi/efi-device.c +++ b/arch/efi/efi/efi-device.c @@ -168,8 +168,10 @@ static struct efi_device *efi_add_device(efi_handle_t *handle, efi_guid_t **guid efiret = BS->open_protocol(handle, &efi_device_path_protocol_guid, &devpath, NULL, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL); - if (EFI_ERROR(efiret)) + if (EFI_ERROR(efiret)) { + free(guidarr); return ERR_PTR(-EINVAL); + } efidev = xzalloc(sizeof(*efidev)); -- cgit v1.2.3