Fix memory leak in test_core_api_reliability
authorDavid Barksdale <amatus@amat.us>
Tue, 10 Oct 2017 02:42:12 +0000 (21:42 -0500)
committerDavid Barksdale <amatus@amat.us>
Tue, 10 Oct 2017 02:42:12 +0000 (21:42 -0500)
src/core/test_core_api_reliability.c

index 900c9f73270d92e6d1a0f37ae0e014c29174e56d..528093c9944f7e96507578f7dc11d34d07772733 100644 (file)
@@ -381,6 +381,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,
@@ -518,6 +519,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");