summaryrefslogtreecommitdiff
path: root/InOsEmuPkg/Unix/Sec/EmuThunk.c
diff options
context:
space:
mode:
Diffstat (limited to 'InOsEmuPkg/Unix/Sec/EmuThunk.c')
-rw-r--r--InOsEmuPkg/Unix/Sec/EmuThunk.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/InOsEmuPkg/Unix/Sec/EmuThunk.c b/InOsEmuPkg/Unix/Sec/EmuThunk.c
index 50afbb5cd6..fe68603d3f 100644
--- a/InOsEmuPkg/Unix/Sec/EmuThunk.c
+++ b/InOsEmuPkg/Unix/Sec/EmuThunk.c
@@ -126,13 +126,27 @@ SecMalloc (
return malloc ((size_t)Size);
}
-VOID
+VOID *
+SecValloc (
+ IN UINTN Size
+ )
+{
+ return valloc ((size_t)Size);
+}
+
+BOOLEAN
SecFree (
IN VOID *Ptr
)
{
+ if (EfiSystemMemoryRange (Ptr)) {
+ // If an address range is in the EFI memory map it was alloced via EFI.
+ // So don't free those ranges and let the caller know.
+ return FALSE;
+ }
+
free (Ptr);
- return;
+ return TRUE;
}
@@ -388,6 +402,7 @@ EMU_THUNK_PROTOCOL gEmuThunkProtocol = {
GasketSecReadStdIn,
GasketSecPollStdIn,
GasketSecMalloc,
+ GasketSecValloc,
GasketSecFree,
GasketSecPeCoffGetEntryPoint,
GasketSecPeCoffRelocateImageExtraAction,