]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: Add NULL check to pointer returned from 'AllocateZeroPool'.
authorQiu Shumin <shumin.qiu@intel.com>
Thu, 26 Nov 2015 01:51:52 +0000 (01:51 +0000)
committershenshushi <shenshushi@Edk2>
Thu, 26 Nov 2015 01:51:52 +0000 (01:51 +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: Ruiyu Ni <ruiyu.ni@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18956 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Library/UefiDpLib/Dp.c

index 4d109d037c1b38f255a03e3cb06c9cd00ad403a8..6b06d20749f29c3bc695abd99880fa294061456e 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 - 2013, Intel Corporation. All rights reserved.\r
+  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.\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
@@ -256,6 +256,7 @@ ShellCommandRunDp (
   CustomCumulativeToken = ShellCommandLineGetValue (ParamPackage, L"-c");\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