RedfishPkg: fix memory leak in HiiUtilityLib

Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>

Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
This commit is contained in:
Mike Maslenkin 2023-10-09 00:58:04 +03:00 committed by mergify[bot]
parent 59b6b5059b
commit ed923afda5
1 changed files with 2 additions and 0 deletions

View File

@ -388,11 +388,13 @@ SetQuestionValue (
Question->Value.BufferLen = Question->StorageWidth;
Question->Value.Buffer = AllocateZeroPool (Question->StorageWidth);
if (Question->Value.Buffer == NULL) {
FreePool (TemString);
return EFI_OUT_OF_RESOURCES;
}
CopyMem (Question->Value.Buffer, TemString, StrSize (TemString));
Src = Question->Value.Buffer;
FreePool (TemString);
} else {
CopyMem (&Question->Value.Value, &QuestionValue->Value, sizeof (EFI_IFR_TYPE_VALUE));
Src = (UINT8 *)&Question->Value.Value;