evstr = getenv (GNUNET_TESTING_PREFIX);
if (NULL != evstr)
{
-#if WINDOWS
- static char *evar = GNUNET_TESTING_PREFIX "=";
- GNUNET_break (0 == putenv (evar));
+ /* unsetting the variable will invalidate the pointer! */
+ evstr = GNUNET_strdup (evstr);
+#ifdef WINDOWS
+ GNUNET_break (0 != SetEnvironmentVariable (GNUNET_TESTING_PREFIX, NULL));
#else
GNUNET_break (0 == unsetenv (GNUNET_TESTING_PREFIX));
#endif
NULL);
if (NULL != evstr)
{
+#ifdef WINDOWS
+ GNUNET_assert (0 != SetEnvironmentVariable (GNUNET_TESTING_PREFIX, evstr));
+#else
static char evar[2* PATH_MAX];
GNUNET_assert (0 < GNUNET_snprintf (evar, sizeof (evar),
GNUNET_TESTING_PREFIX "=%s", evstr));
putenv (evar);
- /* do not free evstr */
+#endif
+ GNUNET_free (evstr);
evstr = NULL;
}
GNUNET_free_non_null (hostname);
xconfig_size =
GNUNET_TESTBED_compress_config_ (config, config_size, &xconfig);
GNUNET_free (config);
- wc = GNUNET_malloc (sizeof (struct WriteContext));
+ wc = GNUNET_new (struct WriteContext);
wc->length = xconfig_size + sizeof (struct GNUNET_TESTBED_HelperReply);
reply = GNUNET_realloc (xconfig, wc->length);
memmove (&reply[1], reply, xconfig_size);