diff options
author | Thilo Schulz <arny@ats.s.bawue.de> | 2011-07-15 14:44:06 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-10 22:27:32 +0000 |
commit | a63482883e0e3487da4544699fa9c419cb17127d (patch) | |
tree | f711e82ecebdd863d52f290de8515e898282801b /src/server/sv_net_chan.c | |
parent | f7f76ecf69a2908810007940feff04a42121fd05 (diff) |
- Revert back to Z_Malloc from Hunk_FreeTempMemory introduced in r2077 as Hunk_FreeTempMemory must be freed in LIFO order (#5079) - Introduce SV_ClientFree() to prevent memory leaks r2077 was supposed to fix
Diffstat (limited to 'src/server/sv_net_chan.c')
-rw-r--r-- | src/server/sv_net_chan.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/server/sv_net_chan.c b/src/server/sv_net_chan.c index 79e294f0..a4304566 100644 --- a/src/server/sv_net_chan.c +++ b/src/server/sv_net_chan.c @@ -131,6 +131,27 @@ static void SV_Netchan_Decode( client_t *client, msg_t *msg ) { } #endif + + +/* +================= +SV_Netchan_FreeQueue +================= +*/ +void SV_Netchan_FreeQueue(client_t *client) +{ + netchan_buffer_t *netbuf, *next; + + for(netbuf = client->netchan_start_queue; netbuf; netbuf = next) + { + next = netbuf->next; + Z_Free(netbuf); + } + + client->netchan_start_queue = NULL; + client->netchan_end_queue = &client->netchan_start_queue; +} + /* ================= SV_Netchan_TransmitNextInQueue @@ -160,7 +181,7 @@ void SV_Netchan_TransmitNextInQueue(client_t *client) else Com_DPrintf("#462 Netchan_TransmitNextFragment: remaining queued message\n"); - Hunk_FreeTempMemory(netbuf); + Z_Free(netbuf); } /* @@ -208,7 +229,7 @@ void SV_Netchan_Transmit( client_t *client, msg_t *msg) { netchan_buffer_t *netbuf; Com_DPrintf("#462 SV_Netchan_Transmit: unsent fragments, stacked\n"); - netbuf = (netchan_buffer_t *) Hunk_AllocateTempMemory(sizeof(netchan_buffer_t)); + netbuf = (netchan_buffer_t *) Z_Malloc(sizeof(netchan_buffer_t)); // store the msg, we can't store it encoded, as the encoding depends on stuff we still have to finish sending MSG_Copy(&netbuf->msg, netbuf->msgBuffer, sizeof( netbuf->msgBuffer ), msg); netbuf->next = NULL; |