gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r10396 - gnunet/src/testing


From: gnunet
Subject: [GNUnet-SVN] r10396 - gnunet/src/testing
Date: Mon, 22 Feb 2010 11:56:16 +0100

Author: grothoff
Date: 2010-02-22 11:56:16 +0100 (Mon, 22 Feb 2010)
New Revision: 10396

Modified:
   gnunet/src/testing/testing.c
   gnunet/src/testing/testing_group.c
Log:
fix leaks, code cleanup

Modified: gnunet/src/testing/testing.c
===================================================================
--- gnunet/src/testing/testing.c        2010-02-22 10:48:44 UTC (rev 10395)
+++ gnunet/src/testing/testing.c        2010-02-22 10:56:16 UTC (rev 10396)
@@ -549,6 +549,7 @@
   GNUNET_free (d->cfgfile);
   GNUNET_free_non_null (d->hostname);
   GNUNET_free_non_null (d->username);
+  GNUNET_free_non_null (d->shortname);
   GNUNET_free (d);
   if (NULL != cb)
     cb (cb_cls, NULL);
@@ -779,7 +780,7 @@
   ctx->d2th = NULL;
   GNUNET_CORE_disconnect (ctx->d1core);
   ctx->d1core = NULL;
-
+  GNUNET_free_non_null (ctx->hello);
   GNUNET_free (ctx);
 }
 

Modified: gnunet/src/testing/testing_group.c
===================================================================
--- gnunet/src/testing/testing_group.c  2010-02-22 10:48:44 UTC (rev 10395)
+++ gnunet/src/testing/testing_group.c  2010-02-22 10:56:16 UTC (rev 10396)
@@ -982,7 +982,6 @@
   unsigned int off;
   unsigned int hostcnt;
   uint16_t minport;
-  int tempsize;
 
   if (0 == total)
     {
@@ -1073,18 +1072,18 @@
           GNUNET_CONFIGURATION_get_value_string (pcfg, "PATHS", "SERVICEHOME",
                                                  &baseservicehome))
         {
-          tempsize = snprintf (NULL, 0, "%s/%d/", baseservicehome, off) + 1;
-          newservicehome = GNUNET_malloc (tempsize);
-          snprintf (newservicehome, tempsize, "%s/%d/", baseservicehome, off);
+         GNUNET_asprintf (&newservicehome,
+                          "%s/%d/", baseservicehome, off);
+         GNUNET_free (baseservicehome);
         }
       else
         {
           tmpdir = getenv ("TMPDIR");
           tmpdir = tmpdir ? tmpdir : "/tmp";
-          tempsize = snprintf (NULL, 0, "%s/%s/%d/", tmpdir, 
"gnunet-testing-test-test", off) + 1;
-          newservicehome = GNUNET_malloc (tempsize);
-          snprintf (newservicehome, tempsize, "%s/%d/",
-                    "/tmp/gnunet-testing-test-test", off);
+         GNUNET_asprintf (&newservicehome,
+                          "%s/%s/%d/",
+                          tmpdir,
+                          "gnunet-testing-test-test", off);
         }
       GNUNET_CONFIGURATION_set_value_string (pcfg,
                                              "PATHS",





reply via email to

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