mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-29 00:24:07 +02:00
ShellPkg/Dp: Handle memory allocation failure
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
This commit is contained in:
parent
9168df3dea
commit
d758f80971
@ -259,13 +259,19 @@ ShellCommandRunDp (
|
||||
CustomCumulativeToken = ShellCommandLineGetValue (ParamPackage, L"-c");
|
||||
if (CustomCumulativeToken != NULL) {
|
||||
CustomCumulativeData = AllocateZeroPool (sizeof (PERF_CUM_DATA));
|
||||
ASSERT (CustomCumulativeData != NULL);
|
||||
if (CustomCumulativeData == NULL) {
|
||||
return SHELL_OUT_OF_RESOURCES;
|
||||
}
|
||||
CustomCumulativeData->MinDur = 0;
|
||||
CustomCumulativeData->MaxDur = 0;
|
||||
CustomCumulativeData->Count = 0;
|
||||
CustomCumulativeData->Duration = 0;
|
||||
NameSize = StrLen (CustomCumulativeToken) + 1;
|
||||
CustomCumulativeData->Name = AllocateZeroPool (NameSize);
|
||||
if (CustomCumulativeData->Name == NULL) {
|
||||
FreePool (CustomCumulativeData);
|
||||
return SHELL_OUT_OF_RESOURCES;
|
||||
}
|
||||
UnicodeStrToAsciiStrS (CustomCumulativeToken, CustomCumulativeData->Name, NameSize);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user