From 29056ed2de064a03301e96919a61c2d188e4b66e Mon Sep 17 00:00:00 2001 From: xdu2 Date: Fri, 25 Dec 2009 09:49:38 +0000 Subject: [PATCH] Add check before free DevicePath (TCP child sock will have no device path installed) git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9617 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c index d38c10172e..2b924c4b4b 100644 --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dispatcher.c @@ -227,14 +227,16 @@ Tcp4FlushPcb ( RemoveEntryList (&Tcb->List); // - // Uninstall the device path protocl. + // Uninstall the device path protocol. // - gBS->UninstallProtocolInterface ( - Sock->SockHandle, - &gEfiDevicePathProtocolGuid, - Sock->DevicePath - ); - FreePool (Sock->DevicePath); + if (Sock->DevicePath != NULL) { + gBS->UninstallProtocolInterface ( + Sock->SockHandle, + &gEfiDevicePathProtocolGuid, + Sock->DevicePath + ); + FreePool (Sock->DevicePath); + } TcpSetVariableData (TcpProto->TcpService); }