MEASUREMENT_RECORD Measurement;\r
UINT64 Duration;\r
UINTN LogEntryKey;\r
- UINTN TIndex;\r
+ INTN TIndex;\r
\r
LogEntryKey = 0;\r
while ((LogEntryKey = GetPerformanceMeasurement (\r
// Get Handle information\r
//\r
Size = 0;\r
- HandleBuffer = NULL;\r
+ HandleBuffer = &TempHandle;\r
Status = gBS->LocateHandle (AllHandles, NULL, NULL, &Size, &TempHandle);\r
if (Status == EFI_BUFFER_TOO_SMALL) {\r
HandleBuffer = AllocatePool (Size);\r
ASSERT (HandleBuffer != NULL);\r
+ if (HandleBuffer == NULL) {\r
+ return;\r
+ }\r
Status = gBS->LocateHandle (AllHandles, NULL, NULL, &Size, HandleBuffer);\r
}\r
if (EFI_ERROR (Status)) {\r
);\r
}\r
}\r
- FreePool (HandleBuffer);\r
+ if (HandleBuffer != &TempHandle) {\r
+ FreePool (HandleBuffer);\r
+ }\r
}\r
\r
/** Gather and print Raw Trace Records.\r
(StringPtr == NULL) ? ALit_UNKNOWN: StringPtr);\r
\r
Size = 0;\r
- HandleBuffer = NULL;\r
+ HandleBuffer = &TempHandle;\r
Status = gBS->LocateHandle (AllHandles, NULL, NULL, &Size, &TempHandle);\r
if (Status == EFI_BUFFER_TOO_SMALL) {\r
HandleBuffer = AllocatePool (Size);\r
ASSERT (HandleBuffer != NULL);\r
+ if (HandleBuffer == NULL) {\r
+ return;\r
+ }\r
Status = gBS->LocateHandle (AllHandles, NULL, NULL, &Size, HandleBuffer);\r
}\r
if (EFI_ERROR (Status)) {\r
}\r
}\r
}\r
- FreePool (HandleBuffer);\r
+ if (HandleBuffer != &TempHandle) {\r
+ FreePool (HandleBuffer);\r
+ }\r
return Status;\r
}\r
\r