OcAudioDump: Free handle buffers after use
@@ -572,6 +572,8 @@ OcAudioDump (
UINTN HdaWidgetCount;
UINT32 HdaWidgetIndex;
+ HandleCount = 0;
+
//
// Get all HDA controller instances.
//
@@ -582,9 +584,9 @@ OcAudioDump (
&HandleCount,
&HandleBuffer
);
+ DEBUG ((DEBUG_INFO, "OCAU: %u HDA controllers installed - %r\n", (UINT32) HandleCount, Status));
- DEBUG ((DEBUG_INFO, "OCAU: %u HDA controllers installed\n", HandleCount));
-
+ if (Status == EFI_SUCCESS) {
for (Index = 0; Index < HandleCount; Index++) {
Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiHdaControllerInfoProtocolGuid, (VOID **) &HdaControllerInfo);
DEBUG ((DEBUG_INFO, "OCAU: HDA controller %u info open result - %r\n", Index, Status));
@@ -629,8 +631,13 @@ OcAudioDump (
FreePool (FileBuffer);
}
+
+ FreePool (HandleBuffer);
+ }
}
+ HandleCount = 0;
+
//
// Get all HDA codec instances.
//
@@ -641,9 +648,9 @@ OcAudioDump (
&HandleCount,
&HandleBuffer
);
+ DEBUG ((DEBUG_INFO, "OCAU: %u HDA codecs installed - %r\n", (UINT32) HandleCount, Status));
- DEBUG ((DEBUG_INFO, "OCAU: %u HDA codecs installed\n", HandleCount));
-
+ if (Status == EFI_SUCCESS) {
for (Index = 0; Index < HandleCount; Index++) {
Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiHdaCodecInfoProtocolGuid, (VOID **) &HdaCodecInfo);
DEBUG ((DEBUG_INFO, "OCAU: HDA codec %u info open result - %r\n", Index, Status));
@@ -731,5 +738,8 @@ OcAudioDump (
}
}
+ FreePool (HandleBuffer);
+ }
+
return EFI_SUCCESS;
}
