From 322afa48f37a70db8c26a5c9561801861ad5d22f Mon Sep 17 00:00:00 2001 From: Qiu Shumin Date: Fri, 18 Dec 2015 07:36:16 +0000 Subject: 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 Reviewed-by: Ruiyu Ni git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2015@19405 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Library/UefiDpLib/Dp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ShellPkg/Library') diff --git a/ShellPkg/Library/UefiDpLib/Dp.c b/ShellPkg/Library/UefiDpLib/Dp.c index 4d109d037c..6b06d20749 100644 --- a/ShellPkg/Library/UefiDpLib/Dp.c +++ b/ShellPkg/Library/UefiDpLib/Dp.c @@ -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
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -256,6 +256,7 @@ ShellCommandRunDp ( 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; -- cgit v1.2.3