From 968e143192174bd1e6e68660540b32484b30c417 Mon Sep 17 00:00:00 2001 From: sfu5 Date: Thu, 25 Apr 2013 01:38:06 +0000 Subject: [PATCH] Check for NULL pointer before free it. Signed-off-by: Fu Siyuan Reviewed-by: Ye Ting Reviewed-by: Dong Guo git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14316 6f19259b-4bc3-4df7-8a09-765794883524 --- .../SecureBootConfigDxe/SecureBootConfigFileExplorer.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c index deff87bcbd..548d95df53 100644 --- a/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c +++ b/SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigFileExplorer.c @@ -1,7 +1,7 @@ /** @file Internal file explorer functions for SecureBoot configuration module. -Copyright (c) 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2012 - 2013, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -323,7 +323,7 @@ DestroyMenuEntry ( FileContext = (SECUREBOOT_FILE_CONTEXT *) MenuEntry->FileContext; - if (!FileContext->IsRoot) { + if (!FileContext->IsRoot && FileContext->DevicePath != NULL) { FreePool (FileContext->DevicePath); } else { if (FileContext->FHandle != NULL) { @@ -340,7 +340,9 @@ DestroyMenuEntry ( FreePool (FileContext); - FreePool (MenuEntry->DisplayString); + if (MenuEntry->DisplayString != NULL) { + FreePool (MenuEntry->DisplayString); + } if (MenuEntry->HelpString != NULL) { FreePool (MenuEntry->HelpString); } -- 2.39.2