OcDevicePropertyLib: Fix bugs reported by Download-Fritz
@@ -485,8 +485,8 @@ DppDbRemoveProperty (
--Node->Hdr.NumberOfProperties;
- // BUG: Name and Value are not freed.
-
+ gBS->FreePool ((VOID *)Property->Name);
+ gBS->FreePool ((VOID *)Property->Value);
gBS->FreePool ((VOID *)Property);
Status = EFI_SUCCESS;
@@ -882,8 +882,10 @@ OcDevicePathPropertyInstallProtocol (
} else {
DevicePathPropertyData = AllocatePool (sizeof (*DevicePathPropertyData));
- // BUG: Compare against != NULL.
- ASSERT (DevicePathPropertyData);
+ if (DevicePathPropertyData == NULL) {
+ Status = EFI_OUT_OF_RESOURCES;
+ goto Done;
+ }
DevicePathPropertyData->Signature = DEVICE_PATH_PROPERTY_DATA_SIGNATURE;
@@ -950,14 +952,6 @@ OcDevicePathPropertyInstallProtocol (
Index
);
- // BUG: Don't keep copying APPLE_PATH_PROPERTIES_VARIABLE_NAME.
-
- StrCpyS (
- VariableName,
- sizeof (VariableName)/sizeof (CHAR16),
- APPLE_PATH_PROPERTIES_VARIABLE_NAME
- );
-
StrCatS (VariableName, sizeof (VariableName)/sizeof (CHAR16), IndexBuffer);
VariableSize = MIN (
@@ -991,14 +985,6 @@ OcDevicePathPropertyInstallProtocol (
Index
);
- // BUG: Don't keep copying APPLE_PATH_PROPERTIES_VARIABLE_NAME.
-
- StrCpyS (
- VariableName,
- sizeof (VariableName)/sizeof (CHAR16),
- APPLE_PATH_PROPERTIES_VARIABLE_NAME
- );
-
StrCatS (VariableName, sizeof (VariableName)/sizeof (CHAR16), IndexBuffer);
VariableSize = 0;
