-fix shutdown segv if GNS connection was down
authorChristian Grothoff <christian@grothoff.org>
Sun, 29 Sep 2013 14:30:09 +0000 (14:30 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sun, 29 Sep 2013 14:30:09 +0000 (14:30 +0000)
src/gns/gns_api.c

index 0963bdc5a86991cd35e7f5531d20ba1a8a9ce259..7b97c6df8e4d42b696d9d076fd5267831279e255 100644 (file)
@@ -474,7 +474,11 @@ GNUNET_GNS_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
 void
 GNUNET_GNS_disconnect (struct GNUNET_GNS_Handle *handle)
 {
-  GNUNET_CLIENT_disconnect (handle->client);
+  if (NULL != handle->client)
+  {
+    GNUNET_CLIENT_disconnect (handle->client);
+    handle->client = NULL;
+  }
   if (GNUNET_SCHEDULER_NO_TASK != handle->reconnect_task)
   {
     GNUNET_SCHEDULER_cancel (handle->reconnect_task);