]> git.proxmox.com Git - mirror_edk2.git/commitdiff
PerformancePkg\Dp_App: Add NULL check to pointer returned from 'AllocateZeroPool'.
authorQiu Shumin <shumin.qiu@intel.com>
Thu, 26 Nov 2015 01:47:14 +0000 (01:47 +0000)
committershenshushi <shenshushi@Edk2>
Thu, 26 Nov 2015 01:47:14 +0000 (01:47 +0000)
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

PerformancePkg/Dp_App/Dp.c

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