gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r30633 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r30633 - gnunet/src/mesh
Date: Fri, 8 Nov 2013 16:21:12 +0100

Author: bartpolot
Date: 2013-11-08 16:21:12 +0100 (Fri, 08 Nov 2013)
New Revision: 30633

Modified:
   gnunet/src/mesh/gnunet-service-mesh_connection.c
Log:
- fix double free


Modified: gnunet/src/mesh/gnunet-service-mesh_connection.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh_connection.c    2013-11-08 15:13:08 UTC 
(rev 30632)
+++ gnunet/src/mesh/gnunet-service-mesh_connection.c    2013-11-08 15:21:12 UTC 
(rev 30633)
@@ -506,10 +506,13 @@
   fc = fwd ? &c->fwd_fc : &c->bck_fc;
   LOG (GNUNET_ERROR_TYPE_DEBUG, "!  sent %s\n", GNUNET_MESH_DEBUG_M2S (type));
   LOG (GNUNET_ERROR_TYPE_DEBUG, "!  C_P- %p %u\n", c, c->pending_messages);
-  if (NULL != q && NULL != q->cont)
+  if (NULL != q)
   {
-    LOG (GNUNET_ERROR_TYPE_DEBUG, "!  calling cont\n");
-    q->cont (q->cont_cls, c, q, type, fwd, size);
+    if (NULL != q->cont)
+    {
+      LOG (GNUNET_ERROR_TYPE_DEBUG, "!  calling cont\n");
+      q->cont (q->cont_cls, c, q, type, fwd, size);
+    }
     GNUNET_free (q);
   }
   c->pending_messages--;
@@ -2439,6 +2442,7 @@
   q = GNUNET_new (struct MeshConnectionQueue);
   q->q = GMP_queue_add (get_hop (c, fwd), data, type, size, c, fwd,
                         &message_sent, q);
+  GNUNET_assert (NULL != q->q);
   q->cont = cont;
   q->cont_cls = cont_cls;
   return q;
@@ -2462,10 +2466,9 @@
 GMC_cancel (struct MeshConnectionQueue *q)
 {
   LOG (GNUNET_ERROR_TYPE_DEBUG, "!  GMC cancel message\n");
-  /* queue destroy calls message_sent, which calls q->cont */
+
+  /* queue destroy calls message_sent, which calls q->cont and frees q */
   GMP_queue_destroy (q->q, GNUNET_YES);
-
-  GNUNET_free (q);
 }
 
 




reply via email to

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