-fix 0-termination
authorChristian Grothoff <christian@grothoff.org>
Fri, 8 Jul 2016 18:20:41 +0000 (18:20 +0000)
committerChristian Grothoff <christian@grothoff.org>
Fri, 8 Jul 2016 18:20:41 +0000 (18:20 +0000)
src/util/mq.c

index 9709fb6c8d28c7e3fd5bd571207d5bc6030e6307..8a46414d2e3d287605da0dbcca6bff000a929705 100644 (file)
@@ -827,11 +827,11 @@ GNUNET_MQ_queue_for_connection_client (struct GNUNET_CLIENT_Connection *connecti
   if (NULL != handlers)
   {
     for (i=0;NULL != handlers[i].cb; i++) ;
-    mq->handlers = GNUNET_new_array (i,
+    mq->handlers = GNUNET_new_array (i + 1,
                                     struct GNUNET_MQ_MessageHandler);
     GNUNET_memcpy (mq->handlers,
-           handlers,
-           i * sizeof (struct GNUNET_MQ_MessageHandler));
+                   handlers,
+                   i * sizeof (struct GNUNET_MQ_MessageHandler));
   }
   mq->error_handler = error_handler;
   mq->error_handler_cls = error_handler_cls;