mirror of
https://github.com/acidanthera/OpenCorePkg.git
synced 2025-12-08 19:25:01 +00:00
OpenCore: Avoid dangling booter protocol on load failure
This commit is contained in:
parent
7bbf38a498
commit
fd47a4db0c
@ -55,3 +55,4 @@
|
||||
MemoryAllocationLib
|
||||
OcDevicePathLib
|
||||
OcFileLib
|
||||
OcStringLib
|
||||
|
||||
@ -203,18 +203,6 @@ UefiMain (
|
||||
return EFI_ALREADY_STARTED;
|
||||
}
|
||||
|
||||
BootstrapHandle = NULL;
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&BootstrapHandle,
|
||||
&gOcBootstrapProtocolGuid,
|
||||
&mOpenCoreBootStrap,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "OC: Failed to install bootstrap protocol - %r\n", Status));
|
||||
return Status;
|
||||
}
|
||||
|
||||
LoadedImage = NULL;
|
||||
Status = gBS->HandleProtocol (
|
||||
ImageHandle,
|
||||
@ -227,6 +215,18 @@ UefiMain (
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
BootstrapHandle = NULL;
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&BootstrapHandle,
|
||||
&gOcBootstrapProtocolGuid,
|
||||
&mOpenCoreBootStrap,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "OC: Failed to install bootstrap protocol - %r\n", Status));
|
||||
return Status;
|
||||
}
|
||||
|
||||
DebugPrintDevicePath (DEBUG_INFO, "OC: Booter path", LoadedImage->FilePath);
|
||||
|
||||
if (LoadedImage->FilePath == NULL) {
|
||||
|
||||
@ -59,7 +59,7 @@ OcKernelReadDarwinVersion (
|
||||
Offset += L_STR_LEN ("Darwin Kernel Version ");
|
||||
|
||||
for (Index = 0; Index < DarwinVersionSize - 1; ++Index, ++Offset) {
|
||||
if (Offset >= KernelSize || Kernel[Offset] == ':') {
|
||||
if ((UINT32) Offset >= KernelSize || Kernel[Offset] == ':') {
|
||||
break;
|
||||
}
|
||||
DarwinVersion[Index] = (CHAR8) Kernel[Offset];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user