From a87e8505b1509fb00bc586b7e00c884487c4298d Mon Sep 17 00:00:00 2001 From: Mike Maslenkin Date: Wed, 30 Aug 2023 00:30:15 +0300 Subject: RedfishPkg: RedfishDiscoverDxe: fix memory leak on error path. Cc: Nickle Wang Cc: Igor Kulchytskyy Signed-off-by: Mike Maslenkin Reviewed-by: Abner Chang --- RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'RedfishPkg') diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c index 06d8d00da7..e344e06d8d 100644 --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c @@ -829,6 +829,10 @@ AddAndSignalNewRedfishService ( } while (TRUE); } + if (Char16Uuid != NULL) { + FreePool (Char16Uuid); + } + if (NewFound || InfoRefresh) { if (!InfoRefresh) { DiscoveredList = (EFI_REDFISH_DISCOVERED_INTERNAL_LIST *)AllocateZeroPool (sizeof (EFI_REDFISH_DISCOVERED_INTERNAL_LIST)); @@ -907,10 +911,6 @@ AddAndSignalNewRedfishService ( } } - if (Char16Uuid != NULL) { - FreePool ((VOID *)Char16Uuid); - } - Status = EFI_SUCCESS; if (NewFound || InfoRefresh) { // -- cgit v1.2.3