public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/2] MdeModulePkg/Core/Dxe: Fix memory leak issues
@ 2022-08-15 21:41 Mike Maslenkin
  2022-08-15 21:41 ` [PATCH 1/2] MdeModulePkg/Core/Dxe: Fix memory leak issue in FwVol.c Mike Maslenkin
  2022-08-15 21:41 ` [PATCH 2/2] MdeModulePkg/Core/Dxe: Fix memory leak issue in FwVolBlock.c Mike Maslenkin
  0 siblings, 2 replies; 3+ messages in thread
From: Mike Maslenkin @ 2022-08-15 21:41 UTC (permalink / raw)
  To: devel; +Cc: Liming Gao, Dandan Bi, Mike Maslenkin

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Dandan Bi <dandan.bi@intel.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] MdeModulePkg/Core/Dxe: Fix memory leak issue in FwVol.c
  2022-08-15 21:41 [PATCH 0/2] MdeModulePkg/Core/Dxe: Fix memory leak issues Mike Maslenkin
@ 2022-08-15 21:41 ` Mike Maslenkin
  2022-08-15 21:41 ` [PATCH 2/2] MdeModulePkg/Core/Dxe: Fix memory leak issue in FwVolBlock.c Mike Maslenkin
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Maslenkin @ 2022-08-15 21:41 UTC (permalink / raw)
  To: devel; +Cc: Mike Maslenkin, Liming Gao, Dandan Bi

FwVolHeader must be deallocated on error path.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Dandan Bi <dandan.bi@intel.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
---
 MdeModulePkg/Core/Dxe/FwVol/FwVol.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MdeModulePkg/Core/Dxe/FwVol/FwVol.c b/MdeModulePkg/Core/Dxe/FwVol/FwVol.c
index 153bfecafa77..0c1554ba4d63 100644
--- a/MdeModulePkg/Core/Dxe/FwVol/FwVol.c
+++ b/MdeModulePkg/Core/Dxe/FwVol/FwVol.c
@@ -659,6 +659,7 @@ NotifyFwVolBlock (
       //
       FvDevice = AllocateCopyPool (sizeof (FV_DEVICE), &mFvDevice);
       if (FvDevice == NULL) {
+        CoreFreePool (FwVolHeader);
         return;
       }
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] MdeModulePkg/Core/Dxe: Fix memory leak issue in FwVolBlock.c
  2022-08-15 21:41 [PATCH 0/2] MdeModulePkg/Core/Dxe: Fix memory leak issues Mike Maslenkin
  2022-08-15 21:41 ` [PATCH 1/2] MdeModulePkg/Core/Dxe: Fix memory leak issue in FwVol.c Mike Maslenkin
@ 2022-08-15 21:41 ` Mike Maslenkin
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Maslenkin @ 2022-08-15 21:41 UTC (permalink / raw)
  To: devel; +Cc: Mike Maslenkin, Liming Gao, Dandan Bi

FvbDev->LbaCache must be freed on error path before deallocating FvbDev.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Dandan Bi <dandan.bi@intel.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
---
 MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
index d81334ce24d1..9f5f40e5cd49 100644
--- a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
+++ b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
@@ -551,6 +551,7 @@ ProduceFVBProtocolOnBuffer (
     //
     FvbDev->DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)AllocateCopyPool (sizeof (FV_MEMMAP_DEVICE_PATH), &mFvMemmapDevicePathTemplate);
     if (FvbDev->DevicePath == NULL) {
+      FreePool (FvbDev->LbaCache);
       FreePool (FvbDev);
       return EFI_OUT_OF_RESOURCES;
     }
@@ -563,6 +564,7 @@ ProduceFVBProtocolOnBuffer (
     //
     FvbDev->DevicePath = (EFI_DEVICE_PATH_PROTOCOL *)AllocateCopyPool (sizeof (FV_PIWG_DEVICE_PATH), &mFvPIWGDevicePathTemplate);
     if (FvbDev->DevicePath == NULL) {
+      FreePool (FvbDev->LbaCache);
       FreePool (FvbDev);
       return EFI_OUT_OF_RESOURCES;
     }
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-15 21:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-15 21:41 [PATCH 0/2] MdeModulePkg/Core/Dxe: Fix memory leak issues Mike Maslenkin
2022-08-15 21:41 ` [PATCH 1/2] MdeModulePkg/Core/Dxe: Fix memory leak issue in FwVol.c Mike Maslenkin
2022-08-15 21:41 ` [PATCH 2/2] MdeModulePkg/Core/Dxe: Fix memory leak issue in FwVolBlock.c Mike Maslenkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox