From 9cda0af7ecfcfc5446da13e63b1930a0d83c0f3f Mon Sep 17 00:00:00 2001 From: Hao Wu Date: Mon, 4 Jul 2016 12:38:28 +0800 Subject: MdeModulePkg MemoryProfile: Add ASSERTs to make sure pointers are not NULL Code logic ensures that both pointers 'DriverInfoData' and 'AllocInfoData' will not be NULL when they are used. Add ASSERTs as warning for cases that will not happen. Cc: Star Zeng Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu Reviewed-by: Star Zeng --- MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c | 3 +++ MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c | 3 +++ 2 files changed, 6 insertions(+) (limited to 'MdeModulePkg') diff --git a/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c b/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c index 14c4959f9f..30c0df46d6 100644 --- a/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c +++ b/MdeModulePkg/Core/Dxe/Mem/MemoryProfileRecord.c @@ -1283,6 +1283,9 @@ CoreUpdateProfileFree ( } } + ASSERT (DriverInfoData != NULL); + ASSERT (AllocInfoData != NULL); + Found = TRUE; Context = &ContextData->Context; diff --git a/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c b/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c index 281e382d5c..ac832ce38c 100644 --- a/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c +++ b/MdeModulePkg/Core/PiSmmCore/SmramProfileRecord.c @@ -1403,6 +1403,9 @@ SmmCoreUpdateProfileFree ( } } + ASSERT (DriverInfoData != NULL); + ASSERT (AllocInfoData != NULL); + Found = TRUE; Context = &ContextData->Context; -- cgit v1.2.3