Skip to content

Commit 38f0a9c

Browse files
committed
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 <[email protected]>
1 parent 92630f2 commit 38f0a9c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mok.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ mirror_mok_db(CHAR16 *name, EFI_GUID *guid, UINT32 attrs,
604604
return efi_status;
605605
}
606606

607-
CHAR16 *namen;
607+
CHAR16 *namen = NULL;
608608
UINTN namelen, namesz;
609609

610610
namelen = StrLen(name);
@@ -726,6 +726,9 @@ mirror_mok_db(CHAR16 *name, EFI_GUID *guid, UINT32 attrs,
726726
break;
727727
i++;
728728
}
729+
if (namen && namen != name) {
730+
FreePool(namen);
731+
}
729732

730733
if (EFI_ERROR(efi_status)) {
731734
perror(L"Failed to set %s: %r\n", name, efi_status);

0 commit comments

Comments
 (0)