From 094466f65654e6e53b6022559a0c33c60101958a Mon Sep 17 00:00:00 2001 From: Bing Luo Date: Sun, 29 Dec 2024 10:20:31 +0800 Subject: [PATCH] NetworkPkg/UefiPxeBcDxe: Bugfix for pxe driver Ensure the poniter is not null before free it Signed-off-by: Bing Luo --- NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c index 4cd915b41157..92f097277c5f 100644 --- a/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcDriver.c @@ -246,7 +246,9 @@ PxeBcDestroyIp4Children ( &Private->PxeBc, NULL ); - FreePool (Private->Ip4Nic->DevicePath); + if (Private->Ip4Nic->DevicePath != NULL) { + FreePool (Private->Ip4Nic->DevicePath); + } if (Private->Snp != NULL) { // @@ -407,7 +409,9 @@ PxeBcDestroyIp6Children ( &Private->PxeBc, NULL ); - FreePool (Private->Ip6Nic->DevicePath); + if (Private->Ip6Nic->DevicePath != NULL) { + FreePool (Private->Ip6Nic->DevicePath); + } if (Private->Snp != NULL) { //