- Print(L"Setting OS version to '%s'\n", AppleOSVersion);
- AppleOSVersion8 = AllocateZeroPool((StrLen(AppleOSVersion) + 1) * sizeof(CHAR8));
- UnicodeStrToAsciiStr(AppleOSVersion, AppleOSVersion8);
- if (AppleOSVersion8) {
- Print(L"Calling set_os_version()\n");
- Status = refit_call1_wrapper (set_os->set_os_version, AppleOSVersion8);
- Print(L"Returned %lx\n", Status);
- if (EFI_ERROR(Status))
- Print(L"ERROR! Returned %x\n", Status);
- } else {
- Status = EFI_OUT_OF_RESOURCES;
- Print(L"Out of resources!\n");
- }
- }
-
- if (/* (Status == EFI_SUCCESS) && */ (set_os->version == 2)) {
- Print(L"Setting OS vendor....");
- Status = refit_call1_wrapper (set_os->set_os_vendor, "Apple Inc.");
- Print(L"Returned %x\n", Status);
- }
-
- if (Status != EFI_SUCCESS) {
+ if (AppleOSVersion) {
+ AppleOSVersion8 = AllocateZeroPool((StrLen(AppleOSVersion) + 1) * sizeof(CHAR8));
+ UnicodeStrToAsciiStr(AppleOSVersion, AppleOSVersion8);
+ if (AppleOSVersion8) {
+ Status = refit_call1_wrapper (SetOs->SetOsVersion, AppleOSVersion8);
+ if (!EFI_ERROR(Status))
+ Status = EFI_SUCCESS;
+ MyFreePool(AppleOSVersion8);
+ } else {
+ Status = EFI_OUT_OF_RESOURCES;
+ Print(L"Out of resources in SetAppleOSInfo!\n");
+ }
+ if ((Status == EFI_SUCCESS) && (SetOs->Version == 2))
+ Status = refit_call1_wrapper (SetOs->SetOsVendor, "Apple Inc.");
+ MyFreePool(AppleOSVersion);
+ } // if (AppleOSVersion)
+ } // if
+ if (Status != EFI_SUCCESS)