gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated: prevent crash on exit


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: prevent crash on exit
Date: Tue, 21 Feb 2017 10:41:55 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new aad47a309 prevent crash on exit
aad47a309 is described below

commit aad47a3092ff6139902c28d84d4e53453ade6343
Author: Christian Grothoff <address@hidden>
AuthorDate: Tue Feb 21 10:41:53 2017 +0100

    prevent crash on exit
---
 src/cadet/cadet_api_new.c |  2 +-
 src/util/service_new.c    | 28 ++++------------------------
 2 files changed, 5 insertions(+), 25 deletions(-)

diff --git a/src/cadet/cadet_api_new.c b/src/cadet/cadet_api_new.c
index 7ed681a9d..100c02a69 100644
--- a/src/cadet/cadet_api_new.c
+++ b/src/cadet/cadet_api_new.c
@@ -1244,7 +1244,7 @@ GNUNET_CADET_close_port (struct GNUNET_CADET_Port *p)
                  GNUNET_CONTAINER_multihashmap_remove (p->cadet->ports,
                                                        &p->id,
                                                        p));
-  GNUNET_free (p->handlers);
+  GNUNET_free_non_null (p->handlers);
   GNUNET_free (p);
 }
 
diff --git a/src/util/service_new.c b/src/util/service_new.c
index 8d654c0cb..1b3254cca 100644
--- a/src/util/service_new.c
+++ b/src/util/service_new.c
@@ -1624,17 +1624,7 @@ GNUNET_SERVICE_starT (const char *service_name,
   sh->connect_cb = connect_cb;
   sh->disconnect_cb = disconnect_cb;
   sh->cb_cls = cls;
-  if (NULL != handlers)
-  {
-    unsigned int i;
-
-    for (i=0;NULL != handlers[i].cb; i++) ;
-    sh->handlers = GNUNET_new_array (i + 1,
-                                    struct GNUNET_MQ_MessageHandler);
-    GNUNET_memcpy (sh->handlers,
-                   handlers,
-                   i * sizeof (struct GNUNET_MQ_MessageHandler));
-  }
+  sh->handlers = GNUNET_MQ_copy_handlers (handlers);
   if (GNUNET_OK != setup_service (sh))
   {
     GNUNET_free (sh->handlers);
@@ -1660,7 +1650,7 @@ GNUNET_SERVICE_stoP (struct GNUNET_SERVICE_Handle *srv)
   while (NULL != (client = srv->clients_head))
     GNUNET_SERVICE_client_drop (client);
   teardown_service (srv);
-  GNUNET_free (srv->handlers);
+  GNUNET_free_non_null (srv->handlers);
   GNUNET_free (srv);
 }
 
@@ -1762,17 +1752,7 @@ GNUNET_SERVICE_ruN_ (int argc,
   sh.connect_cb = connect_cb;
   sh.disconnect_cb = disconnect_cb;
   sh.cb_cls = cls;
-  if (NULL != handlers)
-  {
-    unsigned int i;
-
-    for (i=0;NULL != handlers[i].cb; i++) ;
-    sh.handlers = GNUNET_new_array (i + 1,
-                                    struct GNUNET_MQ_MessageHandler);
-    GNUNET_memcpy (sh.handlers,
-                   handlers,
-                   i * sizeof (struct GNUNET_MQ_MessageHandler));
-  }
+  sh.handlers = GNUNET_MQ_copy_handlers (handlers);
   sh.service_name = service_name;
 
   /* setup subsystems */
@@ -1903,7 +1883,7 @@ shutdown:
   }
 #endif
   teardown_service (&sh);
-  GNUNET_free (sh.handlers);
+  GNUNET_free_non_null (sh.handlers);
   GNUNET_SPEEDUP_stop_ ();
   GNUNET_CONFIGURATION_destroy (cfg);
   GNUNET_free_non_null (logfile);

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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