avoid assertion on NULL mq
authorChristian Grothoff <christian@grothoff.org>
Sun, 19 Jun 2016 22:45:09 +0000 (22:45 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sun, 19 Jun 2016 22:45:09 +0000 (22:45 +0000)
src/scalarproduct/gnunet-service-scalarproduct_alice.c
src/scalarproduct/gnunet-service-scalarproduct_bob.c

index 7eb2d006ca81de7f8742c1203dc6239a8f31636b..d6da754f458c0a8b4d33461c267b057ec175fefd 100644 (file)
@@ -447,18 +447,18 @@ cb_channel_destruction (void *cls,
               "Peer disconnected, terminating session %s with peer %s\n",
               GNUNET_h2s (&s->session_id),
               GNUNET_i2s (&s->peer));
-  if (NULL != s->cadet_mq)
-  {
-    GNUNET_MQ_destroy (s->cadet_mq);
-    s->cadet_mq = NULL;
-  }
-  s->channel = NULL;
   if (GNUNET_SCALARPRODUCT_STATUS_ACTIVE == s->status)
   {
     /* We didn't get an answer yet, fail with error */
     s->status = GNUNET_SCALARPRODUCT_STATUS_FAILURE;
     prepare_client_end_notification (s);
   }
+  if (NULL != s->cadet_mq)
+  {
+    GNUNET_MQ_destroy (s->cadet_mq);
+    s->cadet_mq = NULL;
+  }
+  s->channel = NULL;
 }
 
 
index 79a0e961a5a1d4886425a8f2b89af5e4f1a83eb9..7341317b78a6d2df2163beecdb0314b8f3a9a056 100644 (file)
@@ -497,12 +497,6 @@ cb_channel_destruction (void *cls,
               "Peer disconnected, terminating session %s with peer %s\n",
               GNUNET_h2s (&in->session_id),
               GNUNET_i2s (&in->peer));
-  if (NULL != in->cadet_mq)
-  {
-    GNUNET_MQ_destroy (in->cadet_mq);
-    in->cadet_mq = NULL;
-  }
-  in->channel = NULL;
   if (NULL != (s = in->s))
   {
     if (GNUNET_SCALARPRODUCT_STATUS_ACTIVE == s->status)
@@ -511,6 +505,12 @@ cb_channel_destruction (void *cls,
       prepare_client_end_notification (s);
     }
   }
+  if (NULL != in->cadet_mq)
+  {
+    GNUNET_MQ_destroy (in->cadet_mq);
+    in->cadet_mq = NULL;
+  }
+  in->channel = NULL;
   destroy_cadet_session (in);
 }