fixing 'resolver' double free issue
authorChristian Grothoff <christian@grothoff.org>
Thu, 1 Jul 2010 11:46:31 +0000 (11:46 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 1 Jul 2010 11:46:31 +0000 (11:46 +0000)
src/util/gnunet-service-resolver.c
src/util/server_tc.c

index 5739571aef76fc530935590f8bd1277b3dec9faf..306cf9cecfc77db5177ce7bb4dd306b35ca4d0fc 100644 (file)
@@ -168,6 +168,7 @@ get_ip_as_string (struct GNUNET_SERVER_Client *client,
   if (salen < sizeof (struct sockaddr))
     {
       GNUNET_break (0);
+      GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
       return;
     }
   now = GNUNET_TIME_absolute_get ();
index 7514b0cd334c54d5666e3efa2b499ab37d6996ac..b7158dadbd345266bfd6ed9e2e07895ed48f6205 100644 (file)
@@ -82,6 +82,7 @@ transmit_response (void *cls, size_t size, void *buf)
   if (buf == NULL)
     {
       GNUNET_SERVER_receive_done (tc->client, GNUNET_SYSERR);
+      GNUNET_SERVER_client_drop (tc->client);
       GNUNET_free_non_null (tc->buf);
       GNUNET_free (tc);
       return 0;
@@ -95,6 +96,7 @@ transmit_response (void *cls, size_t size, void *buf)
   if (tc->total == tc->off)
     {
       GNUNET_SERVER_receive_done (tc->client, GNUNET_OK);
+      GNUNET_SERVER_client_drop (tc->client);
       GNUNET_free_non_null (tc->buf);
       GNUNET_free (tc);
     }
@@ -111,6 +113,7 @@ transmit_response (void *cls, size_t size, void *buf)
         {
           GNUNET_break (0);
           GNUNET_SERVER_receive_done (tc->client, GNUNET_SYSERR);
+         GNUNET_SERVER_client_drop (tc->client);
           GNUNET_free_non_null (tc->buf);
           GNUNET_free (tc);
         }
@@ -133,6 +136,7 @@ GNUNET_SERVER_transmit_context_create (struct GNUNET_SERVER_Client *client)
 
   GNUNET_assert (client != NULL);
   tc = GNUNET_malloc (sizeof (struct GNUNET_SERVER_TransmitContext));
+  GNUNET_SERVER_client_keep (client);
   tc->client = client;
   return tc;
 }
@@ -213,6 +217,7 @@ GNUNET_SERVER_transmit_context_run (struct GNUNET_SERVER_TransmitContext *tc,
     {
       GNUNET_break (0);
       GNUNET_SERVER_receive_done (tc->client, GNUNET_SYSERR);
+      GNUNET_SERVER_client_drop (tc->client);
       GNUNET_free_non_null (tc->buf);
       GNUNET_free (tc);
     }