From 38f0a9c2ee9635cbaab9d7d4aa4664027c913cee Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Wed, 12 Mar 2025 14:19:17 -0400 Subject: mirror_mok_db(): Free our mok variable name correctly When we've split a mok variable into name0..nameN, we re-use the same buffer over and over, but we never free it at the end. This frees it. Resolves: Coverity CID 457501 Signed-off-by: Peter Jones --- mok.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'mok.c') diff --git a/mok.c b/mok.c index 98a0a65a..bf71542b 100644 --- a/mok.c +++ b/mok.c @@ -604,7 +604,7 @@ mirror_mok_db(CHAR16 *name, EFI_GUID *guid, UINT32 attrs, return efi_status; } - CHAR16 *namen; + CHAR16 *namen = NULL; UINTN namelen, namesz; namelen = StrLen(name); @@ -726,6 +726,9 @@ mirror_mok_db(CHAR16 *name, EFI_GUID *guid, UINT32 attrs, break; i++; } + if (namen && namen != name) { + FreePool(namen); + } if (EFI_ERROR(efi_status)) { perror(L"Failed to set %s: %r\n", name, efi_status); -- cgit v1.2.3