public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH 1/1] MdeModulePkg/RamDiskDxe: fix memory leak.
@ 2024-04-28 19:18 Mike Maslenkin
  0 siblings, 0 replies; only message in thread
From: Mike Maslenkin @ 2024-04-28 19:18 UTC (permalink / raw)
  To: devel; +Cc: ray.ni, zhichao.gao, gaoliming, Mike Maslenkin

Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
---
 MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c
index 60cf3c8c4a79..2dac121c478c 100644
--- a/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c
+++ b/MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c
@@ -404,7 +404,8 @@ HiiCreateRamDisk (
           );
       } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
 
-      return EFI_DEVICE_ERROR;
+      Status = EFI_DEVICE_ERROR;
+      goto ErrorExit;
     }
   }
 
@@ -431,7 +432,7 @@ HiiCreateRamDisk (
         );
     } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
 
-    return Status;
+    goto ErrorExit;
   }
 
   //
@@ -442,6 +443,10 @@ HiiCreateRamDisk (
   PrivateData->CreateMethod = RamDiskCreateHii;
 
   return EFI_SUCCESS;
+
+ErrorExit:
+  gBS->FreePool (StartingAddr);
+  return Status;
 }
 
 /**
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#118353): https://edk2.groups.io/g/devel/message/118353
Mute This Topic: https://groups.io/mt/105788221/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-28 19:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-28 19:18 [edk2-devel] [PATCH 1/1] MdeModulePkg/RamDiskDxe: fix memory leak Mike Maslenkin

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