MdePkg/Test/DevicePathLib: Remove FreePool(NULL)

Unit test checks if AppendDevicePathInstance() returns NULL.
In those cases, AppendDevicePathInstance() does not allocate
a device path, so the call to FreePool() must not be performed.

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
This commit is contained in:
Michael D Kinney 2024-10-23 18:45:41 -07:00 committed by mergify[bot]
parent d5600f4f5a
commit fadf4f377e

View File

@ -473,11 +473,9 @@ TestAppendDevicePathInstance (
Appended = AppendDevicePathInstance (NULL, NULL);
UT_ASSERT_EQUAL ((uintptr_t)Appended, (uintptr_t)NULL);
FreePool (Appended);
Appended = AppendDevicePathInstance ((EFI_DEVICE_PATH_PROTOCOL *)&mSimpleDevicePath, (EFI_DEVICE_PATH_PROTOCOL *)&mInvalidSimpleDevicePath);
UT_ASSERT_EQUAL ((uintptr_t)Appended, (uintptr_t)NULL);
FreePool (Appended);
return UNIT_TEST_PASSED;
}