gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r34692 - in gnunet/src: ats-tests cadet util


From: gnunet
Subject: [GNUnet-SVN] r34692 - in gnunet/src: ats-tests cadet util
Date: Fri, 19 Dec 2014 15:01:19 +0100

Author: grothoff
Date: 2014-12-19 15:01:18 +0100 (Fri, 19 Dec 2014)
New Revision: 34692

Modified:
   gnunet/src/ats-tests/ats-testing-experiment.c
   gnunet/src/cadet/cadet_api.c
   gnunet/src/util/common_logging.c
Log:
-fix sec_name leak

Modified: gnunet/src/ats-tests/ats-testing-experiment.c
===================================================================
--- gnunet/src/ats-tests/ats-testing-experiment.c       2014-12-19 13:58:01 UTC 
(rev 34691)
+++ gnunet/src/ats-tests/ats-testing-experiment.c       2014-12-19 14:01:18 UTC 
(rev 34692)
@@ -86,9 +86,11 @@
   GNUNET_free (e);
 }
 
+
 static int
-load_episode (struct Experiment *e, struct Episode *cur,
-    struct GNUNET_CONFIGURATION_Handle *cfg)
+load_episode (struct Experiment *e,
+              struct Episode *cur,
+              struct GNUNET_CONFIGURATION_Handle *cfg)
 {
   struct GNUNET_ATS_TEST_Operation *o;
   char *sec_name;
@@ -99,12 +101,12 @@
   int op_counter = 0;
 
   fprintf (stderr, "Parsing episode %u\n",cur->id);
-  GNUNET_asprintf(&sec_name, "episode-%u", cur->id);
+  GNUNET_asprintf (&sec_name, "episode-%u", cur->id);
 
   while (1)
   {
     /* Load operation */
-    GNUNET_asprintf(&op_name, "op-%u-operation", op_counter);
+    GNUNET_asprintf (&op_name, "op-%u-operation", op_counter);
     if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string(cfg,
         sec_name, op_name, &op))
     {
@@ -136,6 +138,7 @@
       GNUNET_free (op);
       GNUNET_free (op_name);
       GNUNET_free (o);
+      GNUNET_free (sec_name);
       return GNUNET_SYSERR;
     }
     GNUNET_free (op_name);
@@ -150,6 +153,7 @@
       GNUNET_free (op);
       GNUNET_free (op_name);
       GNUNET_free (o);
+      GNUNET_free (sec_name);
       return GNUNET_SYSERR;
     }
     if (o->src_id > (e->num_masters - 1))
@@ -159,6 +163,7 @@
       GNUNET_free (op);
       GNUNET_free (op_name);
       GNUNET_free (o);
+      GNUNET_free (sec_name);
       return GNUNET_SYSERR;
     }
     GNUNET_free (op_name);
@@ -173,6 +178,7 @@
       GNUNET_free (op);
       GNUNET_free (op_name);
       GNUNET_free (o);
+      GNUNET_free (sec_name);
       return GNUNET_SYSERR;
     }
     if (o->dest_id > (e->num_slaves - 1))
@@ -182,6 +188,7 @@
       GNUNET_free (op);
       GNUNET_free (op_name);
       GNUNET_free (o);
+      GNUNET_free (sec_name);
       return GNUNET_SYSERR;
     }
     GNUNET_free (op_name);
@@ -252,6 +259,7 @@
           GNUNET_free (op_name);
           GNUNET_free (op);
           GNUNET_free (o);
+          GNUNET_free (sec_name);
           return GNUNET_SYSERR;
         }
       }
@@ -279,6 +287,7 @@
               GNUNET_free (op_name);
               GNUNET_free (op);
               GNUNET_free (o);
+              GNUNET_free (sec_name);
               return GNUNET_SYSERR;
           }
           GNUNET_free (op_name);
@@ -295,6 +304,7 @@
               GNUNET_free (op);
               GNUNET_free_non_null (pref);
               GNUNET_free (o);
+              GNUNET_free (sec_name);
               return GNUNET_SYSERR;
           }
 
@@ -312,6 +322,7 @@
               GNUNET_free (pref);
               GNUNET_free_non_null (pref);
               GNUNET_free (o);
+              GNUNET_free (sec_name);
               return GNUNET_SYSERR;
           }
           GNUNET_free (pref);
@@ -352,6 +363,7 @@
   return GNUNET_OK;
 }
 
+
 static int
 load_episodes (struct Experiment *e, struct GNUNET_CONFIGURATION_Handle *cfg)
 {

Modified: gnunet/src/cadet/cadet_api.c
===================================================================
--- gnunet/src/cadet/cadet_api.c        2014-12-19 13:58:01 UTC (rev 34691)
+++ gnunet/src/cadet/cadet_api.c        2014-12-19 14:01:18 UTC (rev 34692)
@@ -526,13 +526,13 @@
 timeout_transmission (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   struct GNUNET_CADET_TransmitHandle *th = cls;
-  struct GNUNET_CADET_Handle *cadet;
+  struct GNUNET_CADET_Handle *cadet = th->channel->cadet;
 
-  cadet = th->channel->cadet;
+  th->timeout_task = GNUNET_SCHEDULER_NO_TASK;
+  th->channel->packet_size = 0;
   GNUNET_CONTAINER_DLL_remove (cadet->th_head, cadet->th_tail, th);
-  th->channel->packet_size = 0;
   if (GNUNET_YES == th_is_payload (th))
-    th->notify (th->notify_cls, 0, NULL);
+    GNUNET_break (0 == th->notify (th->notify_cls, 0, NULL));
   GNUNET_free (th);
   if ((0 == message_ready_size (cadet)) && (NULL != cadet->th))
   {
@@ -1373,15 +1373,15 @@
     }
     else
     {
-      struct GNUNET_MessageHeader *mh = (struct GNUNET_MessageHeader *) &th[1];
+      const struct GNUNET_MessageHeader *mh;
 
+      mh = (const struct GNUNET_MessageHeader *) &th[1];
       LOG (GNUNET_ERROR_TYPE_DEBUG, "#  cadet internal traffic, type %s\n",
            GC_m2s (ntohs (mh->type)));
       memcpy (cbuf, &th[1], th->size);
       psize = th->size;
     }
     GNUNET_assert (GNUNET_CONSTANTS_MAX_CADET_MESSAGE_SIZE >= psize);
-
     if (th->timeout_task != GNUNET_SCHEDULER_NO_TASK)
       GNUNET_SCHEDULER_cancel (th->timeout_task);
     GNUNET_CONTAINER_DLL_remove (h->th_head, h->th_tail, th);
@@ -1448,9 +1448,6 @@
   th->channel = channel;
   memcpy (&th[1], msg, msize);
   add_to_queue (h, th);
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "  queued\n");
-  if (NULL != h->th)
-    return;
   LOG (GNUNET_ERROR_TYPE_DEBUG, "  calling ntfy tmt rdy for %u bytes\n", 
msize);
   h->th =
       GNUNET_CLIENT_notify_transmit_ready (h->client, msize,
@@ -1656,9 +1653,14 @@
     if (th->channel == channel)
     {
       aux = th->next;
-      /* FIXME call the handler? */
       if (GNUNET_YES == th_is_payload (th))
+      {
+        /* applications should cancel before destroying channel */
+        GNUNET_break (0);
         th->notify (th->notify_cls, 0, NULL);
+      }
+      GNUNET_CADET_notify_transmit_ready_cancel (th);
+
       GNUNET_CONTAINER_DLL_remove (h->th_head, h->th_tail, th);
       GNUNET_free (th);
       th = aux;

Modified: gnunet/src/util/common_logging.c
===================================================================
--- gnunet/src/util/common_logging.c    2014-12-19 13:58:01 UTC (rev 34691)
+++ gnunet/src/util/common_logging.c    2014-12-19 14:01:18 UTC (rev 34692)
@@ -1095,7 +1095,7 @@
 {
   static char buf[256];
   char *ret;
-  
+
   ret = GNUNET_CRYPTO_eddsa_public_key_to_string (&pid->public_key);
   strcpy (buf, ret);
   GNUNET_free (ret);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]