[edk2-devel] [PATCH 5/9] RedfishPkg: RedfishDiscoverDxe: fix memory leak on error path.

Mike Maslenkin posted 9 patches 2 years, 1 month ago
There is a newer version of this series
[edk2-devel] [PATCH 5/9] RedfishPkg: RedfishDiscoverDxe: fix memory leak on error path.
Posted by Mike Maslenkin 2 years, 1 month ago
Cc: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
---
 RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
index 833ae2b969ff..d77af66cb479 100644
--- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
+++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
@@ -862,6 +862,10 @@ AddAndSignalNewRedfishService (
     } while (TRUE);
   }
 
+  if (Char16Uuid != NULL) {
+    FreePool ((VOID *)Char16Uuid);
+  }
+
   if (NewFound || InfoRefresh) {
     if (!InfoRefresh) {
       DiscoveredList = (EFI_REDFISH_DISCOVERED_INTERNAL_LIST *)AllocateZeroPool (sizeof (EFI_REDFISH_DISCOVERED_INTERNAL_LIST));
@@ -940,10 +944,6 @@ AddAndSignalNewRedfishService (
     }
   }
 
-  if (Char16Uuid != NULL) {
-    FreePool ((VOID *)Char16Uuid);
-  }
-
   Status = EFI_SUCCESS;
   if (NewFound || InfoRefresh) {
     //
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112441): https://edk2.groups.io/g/devel/message/112441
Mute This Topic: https://groups.io/mt/103130783/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-