From: fgsfds Date: Mon, 21 Mar 2022 16:46:56 +0000 (+0300) Subject: net: free peer data before disconnect X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=93ad01cbaf1917c194a6c85aa341d7570bc6a2d6;p=d2df-sdl.git net: free peer data before disconnect --- diff --git a/src/game/g_net.pas b/src/game/g_net.pas index 54b06bf..e7cd455 100644 --- a/src/game/g_net.pas +++ b/src/game/g_net.pas @@ -1710,6 +1710,12 @@ begin g_Player_Remove(TP.UID); end; + if (TC^.Peer^.data <> nil) then + begin + FreeMemory(TC^.Peer^.data); + TC^.Peer^.data := nil; + end; + if (Force) then enet_peer_reset(TC^.Peer); @@ -1725,12 +1731,6 @@ begin TC^.NetOut[NET_UNRELIABLE].Free(); TC^.NetOut[NET_RELIABLE].Free(); - if (NetEvent.peer^.data <> nil) then - begin - FreeMemory(NetEvent.peer^.data); - NetEvent.peer^.data := nil; - end; - g_Console_Add(_lc[I_NET_MSG] + Format(_lc[I_NET_MSG_HOST_DISC], [ID])); Dec(NetClientCount);