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); }