The structure instance retunred by ToStructure() must be deallocated
properly.

Cc: Abner Chang <abner.ch...@amd.com>
Cc: Igor Kulchytskyy <ig...@ami.com>
Cc: Nickle Wang <nick...@nvidia.com>
Signed-off-by: Mike Maslenkin <mike.maslen...@gmail.com>
---
 RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c    | 5 ++++-
 .../Features/BootOption/v1_0_4/Common/BootOptionCommon.c     | 5 ++++-
 .../Features/Memory/V1_7_1/Common/MemoryCommon.c             | 5 ++++-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c 
b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
index 1eb269a84222..f40fe215afeb 100644
--- a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
+++ b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
@@ -247,7 +247,6 @@ ProvisioningBiosProperties (
                                  );
   if (EFI_ERROR (Status)) {
     DEBUG ((DEBUG_ERROR, "%a, ToJson() failed: %r\n", __func__, Status));
-    return Status;
   }
 
   //
@@ -258,6 +257,10 @@ ProvisioningBiosProperties (
                         (EFI_REST_JSON_STRUCTURE_HEADER *)Bios
                         );
 
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
   return (PropertyChanged ? EFI_SUCCESS : EFI_NOT_FOUND);
 }
 
diff --git 
a/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCommon.c 
b/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCommon.c
index 339c8ba04103..358b32253973 100644
--- a/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCommon.c
+++ b/RedfishClientPkg/Features/BootOption/v1_0_4/Common/BootOptionCommon.c
@@ -334,7 +334,6 @@ ON_RELEASE:
                                  );
   if (EFI_ERROR (Status)) {
     DEBUG ((DEBUG_ERROR, "%a: ToJson() failed: %r\n", __func__, Status));
-    return Status;
   }
 
   //
@@ -345,6 +344,10 @@ ON_RELEASE:
                         (EFI_REST_JSON_STRUCTURE_HEADER *)BootOption
                         );
 
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
   return (PropertyChanged ? EFI_SUCCESS : EFI_NOT_FOUND);
 }
 
diff --git a/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c 
b/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c
index e873f05ca040..39ec7ec0c34b 100644
--- a/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c
+++ b/RedfishClientPkg/Features/Memory/V1_7_1/Common/MemoryCommon.c
@@ -2133,7 +2133,6 @@ ProvisioningMemoryProperties (
                                  );
   if (EFI_ERROR (Status)) {
     DEBUG ((DEBUG_ERROR, "%a, ToJson() failed: %r\n", __func__, Status));
-    return Status;
   }
 
   //
@@ -2144,6 +2143,10 @@ ProvisioningMemoryProperties (
                         (EFI_REST_JSON_STRUCTURE_HEADER *)Memory
                         );
 
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
+
   return (PropertyChanged ? EFI_SUCCESS : EFI_NOT_FOUND);
 }
 
-- 
2.32.0 (Apple Git-132)



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116566): https://edk2.groups.io/g/devel/message/116566
Mute This Topic: https://groups.io/mt/104841893/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to