shithub: choc

Download patch

ref: 0a55e76dc58993267abb4b0cde944f1babecc242
parent: 8fdfe2014d1be3eb855afc55107df64a1cd784f8
author: Simon Howard <fraggle@gmail.com>
date: Sat Jan 7 22:36:40 EST 2006

Fix double free of addresses

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 267

--- a/src/net_client.c
+++ b/src/net_client.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*- 
 //-----------------------------------------------------------------------------
 //
-// $Id: net_client.c 265 2006-01-08 02:53:31Z fraggle $
+// $Id: net_client.c 267 2006-01-08 03:36:40Z fraggle $
 //
 // Copyright(C) 2005 Simon Howard
 //
@@ -21,6 +21,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.12  2006/01/08 03:36:40  fraggle
+// Fix double free of addresses
+//
 // Revision 1.11  2006/01/08 02:53:31  fraggle
 // Detect when client connection is disconnected.
 //
@@ -119,11 +122,14 @@
 
 static void NET_CL_Shutdown(void)
 {
-    net_client_connected = false;
+    if (net_client_connected)
+    {
+        net_client_connected = false;
 
-    NET_FreeAddress(server_addr);
+        NET_FreeAddress(server_addr);
 
-    // Shut down network module, etc.  To do.
+        // Shut down network module, etc.  To do.
+    }
 }
 
 // data received while we are waiting for the game to start
@@ -231,6 +237,10 @@
         if (addr == server_addr)
         {
             NET_CL_ParsePacket(packet);
+        }
+        else
+        {
+            NET_FreeAddress(addr);
         }
 
         NET_FreePacket(packet);