fix bad free
[oweals/gnunet.git] / src / core / test_core_api_reliability.c
index cd2bcad83639cf9d8acaa95e8ba6eb0741271237..4cc5b4bcda1655f54da3353989be8da501a5ac38 100644 (file)
@@ -2,20 +2,18 @@
      This file is part of GNUnet.
      Copyright (C) 2009, 2010, 2015, 2016 GNUnet e.V.
 
-     GNUnet is free software; you can redistribute it and/or modify
-     it under the terms of the GNU General Public License as published
-     by the Free Software Foundation; either version 3, or (at your
-     option) any later version.
+     GNUnet is free software: you can redistribute it and/or modify it
+     under the terms of the GNU Affero General Public License as published
+     by the Free Software Foundation, either version 3 of the License,
+     or (at your option) any later version.
 
      GNUnet is distributed in the hope that it will be useful, but
      WITHOUT ANY WARRANTY; without even the implied warranty of
      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-     General Public License for more details.
-
-     You should have received a copy of the GNU General Public License
-     along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-     Boston, MA 02110-1301, USA.
+     Affero General Public License for more details.
+    
+     You should have received a copy of the GNU Affero General Public License
+     along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 /**
  * @file core/test_core_api_reliability.c
@@ -103,7 +101,7 @@ terminate_peer (struct PeerContext *p)
 {
   if (NULL != p->ch)
   {
-    GNUNET_CORE_disconnecT (p->ch);
+    GNUNET_CORE_disconnect (p->ch);
     p->ch = NULL;
   }
   if (NULL != p->ghh)
@@ -341,7 +339,7 @@ init_notify (void *cls,
     OKPP;
     /* connect p2 */
     GNUNET_assert (NULL !=
-                  (p2.ch = GNUNET_CORE_connecT (p2.cfg,
+                  (p2.ch = GNUNET_CORE_connect (p2.cfg,
                                                 &p2,
                                                 &init_notify,
                                                 &connect_notify,
@@ -381,6 +379,7 @@ process_hello (void *cls,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Received (my) `%s' from transport service\n", "HELLO");
   GNUNET_assert (message != NULL);
+  GNUNET_free_non_null (p->hello);
   p->hello = GNUNET_copy_message (message);
   if ((p == &p1) && (NULL == p2.oh))
     p2.oh = GNUNET_TRANSPORT_offer_hello (p2.cfg,
@@ -464,7 +463,7 @@ run (void *cls,
                                 NULL);
 
   GNUNET_assert (NULL !=
-                (p1.ch = GNUNET_CORE_connecT (p1.cfg,
+                (p1.ch = GNUNET_CORE_connect (p1.cfg,
                                               &p1,
                                               &init_notify,
                                               &connect_notify,
@@ -518,6 +517,8 @@ main (int argc,
                       &ok);
   stop_arm (&p1);
   stop_arm (&p2);
+  GNUNET_free_non_null (p1.hello);
+  GNUNET_free_non_null (p2.hello);
   GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-1");
   GNUNET_DISK_directory_remove ("/tmp/test-gnunet-core-peer-2");