[PATCH] Fix file handle leak in custom FS label retrieval

5 views
Skip to first unread message

Christian Storm

unread,
Aug 17, 2021, 6:32:57 AM8/17/21
to efibootg...@googlegroups.com, Christian Storm
From: Christian Storm <christi...@siemens.com>

File handle tmp is Open()'d but not Close()'d on the Read()
error condition path, resulting in a file handle leak.
Fix it by calling Close() on this error exit path.

Signed-off-by: Christian Storm <christi...@siemens.com>
---
utils.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/utils.c b/utils.c
index 42ff741..80801b7 100644
--- a/utils.c
+++ b/utils.c
@@ -94,6 +94,7 @@ CHAR16 *get_volume_custom_label(EFI_FILE_HANDLE fh)
}
status = uefi_call_wrapper(tmp->Read, 3, tmp, &buffsize, buffer);
if (status != EFI_SUCCESS) {
+ (VOID)uefi_call_wrapper(fh->Close, 1, tmp);
(VOID)FreePool(buffer);
return NULL;
}
--
2.32.0

Jan Kiszka

unread,
Aug 17, 2021, 6:48:18 AM8/17/21
to Christian Storm, efibootg...@googlegroups.com
Thanks, merged.

Jan

--
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
Reply all
Reply to author
Forward
0 new messages