Revision: 19405
          http://sourceforge.net/p/edk2/code/19405
Author:   vanjeff
Date:     2015-12-18 07:36:16 +0000 (Fri, 18 Dec 2015)
Log Message:
-----------
ShellPkg: 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.

(Sync patch r18956 from main trunk.)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <[email protected]>
Reviewed-by: Ruiyu Ni <[email protected]>

Revision Links:
--------------
    http://sourceforge.net/p/edk2/code/18956

Modified Paths:
--------------
    branches/UDK2015/ShellPkg/Library/UefiDpLib/Dp.c

Modified: branches/UDK2015/ShellPkg/Library/UefiDpLib/Dp.c
===================================================================
--- branches/UDK2015/ShellPkg/Library/UefiDpLib/Dp.c    2015-12-18 07:35:47 UTC 
(rev 19404)
+++ branches/UDK2015/ShellPkg/Library/UefiDpLib/Dp.c    2015-12-18 07:36:16 UTC 
(rev 19405)
@@ -13,7 +13,7 @@
   Dp uses this information to group records in different ways.  It also uses
   timer information to calculate elapsed time for each measurement.
  
-  Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.
+  Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.
   (C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
@@ -256,6 +256,7 @@
   CustomCumulativeToken = ShellCommandLineGetValue (ParamPackage, L"-c");
   if (CustomCumulativeToken != NULL) {
     CustomCumulativeData = AllocateZeroPool (sizeof (PERF_CUM_DATA));
+    ASSERT (CustomCumulativeData != NULL);
     CustomCumulativeData->MinDur = 0;
     CustomCumulativeData->MaxDur = 0;
     CustomCumulativeData->Count  = 0;


------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to