From: Christian Grothoff Date: Mon, 22 Feb 2010 10:56:16 +0000 (+0000) Subject: fix leaks, code cleanup X-Git-Tag: initial-import-from-subversion-38251~22644 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=6b0c9713ef122b8cb0fb7fc12dca579db2c370ee;p=oweals%2Fgnunet.git fix leaks, code cleanup --- diff --git a/src/testing/testing.c b/src/testing/testing.c index 3dd4af367..be3e96509 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c @@ -549,6 +549,7 @@ GNUNET_TESTING_daemon_stop (struct GNUNET_TESTING_Daemon *d, 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 @@ notify_connect_result (void *cls, ctx->d2th = NULL; GNUNET_CORE_disconnect (ctx->d1core); ctx->d1core = NULL; - + GNUNET_free_non_null (ctx->hello); GNUNET_free (ctx); } diff --git a/src/testing/testing_group.c b/src/testing/testing_group.c index 744e505ce..d019bfd70 100644 --- a/src/testing/testing_group.c +++ b/src/testing/testing_group.c @@ -982,7 +982,6 @@ GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched, unsigned int off; unsigned int hostcnt; uint16_t minport; - int tempsize; if (0 == total) { @@ -1073,18 +1072,18 @@ GNUNET_TESTING_daemons_start (struct GNUNET_SCHEDULER_Handle *sched, 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",