summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2025-03-12 14:19:17 -0400
committerPeter Jones <pjones@redhat.com>2025-03-14 11:05:05 -0400
commit38f0a9c2ee9635cbaab9d7d4aa4664027c913cee (patch)
tree76c93a20ff6b61f9253c5d2e5eb60b1c8f5c86ed
parent92630f2e2d63f89bf78842bd0d18fa115270b39c (diff)
downloadefi-boot-shim-38f0a9c2ee9635cbaab9d7d4aa4664027c913cee.tar.gz
efi-boot-shim-38f0a9c2ee9635cbaab9d7d4aa4664027c913cee.zip
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 <pjones@redhat.com>
-rw-r--r--mok.c5
1 files changed, 4 insertions, 1 deletions
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);