X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=OvmfPkg%2FLibrary%2FPciHostBridgeLib%2FPciHostBridgeLib.c;h=25746dd1cfd0c2040a47221478fd21d62d506a8a;hp=2f22d637ae262f7d42b23bf67ff944d7b615c220;hb=dc4d64670a19d4f813e8f3dc7231998615404511;hpb=46e46eaf6215a66e196082a9307b88a78355b073 diff --git a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c index 2f22d637ae..25746dd1cf 100644 --- a/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c +++ b/OvmfPkg/Library/PciHostBridgeLib/PciHostBridgeLib.c @@ -215,7 +215,17 @@ PciHostBridgeFreeRootBridges ( UINTN Count ) { - return; + if (Bridges == NULL && Count == 0) { + return; + } + ASSERT (Bridges != NULL && Count > 0); + + do { + --Count; + UninitRootBridge (&Bridges[Count]); + } while (Count > 0); + + FreePool (Bridges); }