mirror of https://github.com/acidanthera/audk.git
MdeModulePkg/Core/Dxe: Fix memory leak issue in FwVolBlock.c
FvbDev->LbaCache must be freed on error path before freeing FvbDev. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
parent
f18ec60fa4
commit
cc26a2cb31
|
@ -551,6 +551,7 @@ ProduceFVBProtocolOnBuffer (
|
||||||
//
|
//
|
||||||
FvbDev->DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)AllocateCopyPool (sizeof (FV_MEMMAP_DEVICE_PATH), &mFvMemmapDevicePathTemplate);
|
FvbDev->DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)AllocateCopyPool (sizeof (FV_MEMMAP_DEVICE_PATH), &mFvMemmapDevicePathTemplate);
|
||||||
if (FvbDev->DevicePath == NULL) {
|
if (FvbDev->DevicePath == NULL) {
|
||||||
|
FreePool (FvbDev->LbaCache);
|
||||||
FreePool (FvbDev);
|
FreePool (FvbDev);
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
@ -563,6 +564,7 @@ ProduceFVBProtocolOnBuffer (
|
||||||
//
|
//
|
||||||
FvbDev->DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)AllocateCopyPool (sizeof (FV_PIWG_DEVICE_PATH), &mFvPIWGDevicePathTemplate);
|
FvbDev->DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)AllocateCopyPool (sizeof (FV_PIWG_DEVICE_PATH), &mFvPIWGDevicePathTemplate);
|
||||||
if (FvbDev->DevicePath == NULL) {
|
if (FvbDev->DevicePath == NULL) {
|
||||||
|
FreePool (FvbDev->LbaCache);
|
||||||
FreePool (FvbDev);
|
FreePool (FvbDev);
|
||||||
return EFI_OUT_OF_RESOURCES;
|
return EFI_OUT_OF_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue