stuff
[oweals/gnunet.git] / src / util / connection.c
index 4a54aed1d8e4855f6ab2f39f61c33d50d2e031fc..a877e06c2dcde6f6acaaf3e60d15f82babd9a524 100644 (file)
@@ -539,9 +539,14 @@ destroy_continuation (void *cls,
       notify (sock->nth.notify_ready_cls, 0, NULL);
     }
 
-  if ((sock->sock != NULL) && (sock->persist != GNUNET_YES))
-    GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (sock->sock));
-
+  if (sock->sock != NULL) 
+    {
+      if (sock->persist != GNUNET_YES)
+       GNUNET_break (GNUNET_OK == GNUNET_NETWORK_socket_close (sock->sock));
+      else
+       GNUNET_free (sock->sock); /* at least no memory leak (we deliberately
+                                    leak the socket in this special case) ... */
+    }
   GNUNET_free_non_null (sock->addr);
   GNUNET_free_non_null (sock->hostname);
 #if DEBUG_CONNECTION