PerformancePkg\Dp_App: Add NULL check to pointer returned from 'AllocateZeroPool'.

When CustomCumulativeToken is not NULL, the CustomCumulativeData is expected non-NULL.
Add 'ASSERT' statement to ensure this.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin.qiu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18955 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Qiu Shumin 2015-11-26 01:47:14 +00:00 committed by shenshushi
parent 01e3a97671
commit c4ace58253
1 changed files with 2 additions and 1 deletions

View File

@ -13,7 +13,7 @@
Dp uses this information to group records in different ways. It also uses Dp uses this information to group records in different ways. It also uses
timer information to calculate elapsed time for each measurement. timer information to calculate elapsed time for each measurement.
Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR> (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
@ -368,6 +368,7 @@ InitializeDp (
CustomCumulativeToken = ShellCommandLineGetValue (ParamPackage, StringDpOptionLc); CustomCumulativeToken = ShellCommandLineGetValue (ParamPackage, StringDpOptionLc);
if (CustomCumulativeToken != NULL) { if (CustomCumulativeToken != NULL) {
CustomCumulativeData = AllocateZeroPool (sizeof (PERF_CUM_DATA)); CustomCumulativeData = AllocateZeroPool (sizeof (PERF_CUM_DATA));
ASSERT (CustomCumulativeData != NULL);
CustomCumulativeData->MinDur = 0; CustomCumulativeData->MinDur = 0;
CustomCumulativeData->MaxDur = 0; CustomCumulativeData->MaxDur = 0;
CustomCumulativeData->Count = 0; CustomCumulativeData->Count = 0;