[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r22902 - gnunet/src/testbed
From: |
gnunet |
Subject: |
[GNUnet-SVN] r22902 - gnunet/src/testbed |
Date: |
Wed, 25 Jul 2012 11:59:10 +0200 |
Author: harsha
Date: 2012-07-25 11:59:10 +0200 (Wed, 25 Jul 2012)
New Revision: 22902
Modified:
gnunet/src/testbed/gnunet-service-testbed.c
gnunet/src/testbed/gnunet-testbed-helper.c
gnunet/src/testbed/testbed_api.h
gnunet/src/testbed/testbed_api_hosts.c
gnunet/src/testbed/valgrind-zlib.supp
Log:
-fixes mem leaks
Modified: gnunet/src/testbed/gnunet-service-testbed.c
===================================================================
--- gnunet/src/testbed/gnunet-service-testbed.c 2012-07-25 09:45:59 UTC (rev
22901)
+++ gnunet/src/testbed/gnunet-service-testbed.c 2012-07-25 09:59:10 UTC (rev
22902)
@@ -404,17 +404,8 @@
*/
static GNUNET_SCHEDULER_TaskIdentifier shutdown_task_id;
-/******************/
-/* Testing System */
-/******************/
/**
- * Our configuration; we also use this as template for starting other
controllers
- */
-static struct GNUNET_CONFIGURATION_Handle *config;
-
-
-/**
* Function called to notify a client about the connection begin ready to queue
* more data. "buf" will be NULL and "size" zero if the connection was closed
* for writing in the meantime.
@@ -1543,6 +1534,8 @@
GNUNET_free_non_null (master_context->master_ip);
if (NULL != master_context->system)
GNUNET_TESTING_system_destroy (master_context->system, GNUNET_YES);
+ GNUNET_free (master_context);
+ master_context = NULL;
}
}
@@ -1620,7 +1613,6 @@
{NULL}
};
- config = GNUNET_CONFIGURATION_dup (cfg);
GNUNET_SERVER_add_handlers (server,
message_handlers);
GNUNET_SERVER_disconnect_notify (server,
Modified: gnunet/src/testbed/gnunet-testbed-helper.c
===================================================================
--- gnunet/src/testbed/gnunet-testbed-helper.c 2012-07-25 09:45:59 UTC (rev
22901)
+++ gnunet/src/testbed/gnunet-testbed-helper.c 2012-07-25 09:59:10 UTC (rev
22902)
@@ -300,6 +300,7 @@
{
LOG (GNUNET_ERROR_TYPE_WARNING,
"Unable to write config file: %s -- exiting\n", config);
+ GNUNET_CONFIGURATION_destroy (cfg);
GNUNET_free (config);
goto error;
}
@@ -312,13 +313,18 @@
{
LOG (GNUNET_ERROR_TYPE_WARNING,
"Error staring gnunet-service-testbed -- exiting\n");
+ GNUNET_CONFIGURATION_destroy (cfg);
goto error;
}
GNUNET_DISK_pipe_close_end (pipe_out, GNUNET_DISK_PIPE_END_WRITE);
GNUNET_DISK_pipe_close_end (pipe_in, GNUNET_DISK_PIPE_END_READ);
done_reading = GNUNET_YES;
config = GNUNET_CONFIGURATION_serialize (cfg, &config_size);
- xconfig_size = GNUNET_TESTBED_compress_config_ (config, config_size,
&xconfig);
+ GNUNET_CONFIGURATION_destroy (cfg);
+ cfg = NULL;
+ xconfig_size = GNUNET_TESTBED_compress_config_ (config, config_size,
+ &xconfig);
+ GNUNET_free (config);
wc = GNUNET_malloc (sizeof (struct WriteContext));
wc->length = xconfig_size + sizeof (struct GNUNET_TESTBED_HelperReply);
reply = GNUNET_realloc (xconfig, wc->length);
Modified: gnunet/src/testbed/testbed_api.h
===================================================================
--- gnunet/src/testbed/testbed_api.h 2012-07-25 09:45:59 UTC (rev 22901)
+++ gnunet/src/testbed/testbed_api.h 2012-07-25 09:59:10 UTC (rev 22902)
@@ -56,7 +56,12 @@
/**
* Get peer information operation
*/
- OP_PEER_INFO
+ OP_PEER_INFO,
+
+ /**
+ * Overlay connection operation
+ */
+ OP_OVERLAY_CONNECT,
};
Modified: gnunet/src/testbed/testbed_api_hosts.c
===================================================================
--- gnunet/src/testbed/testbed_api_hosts.c 2012-07-25 09:45:59 UTC (rev
22901)
+++ gnunet/src/testbed/testbed_api_hosts.c 2012-07-25 09:59:10 UTC (rev
22902)
@@ -235,6 +235,7 @@
uint16_t port)
{
struct GNUNET_TESTBED_Host *host;
+ uint32_t new_size;
if ((id < host_list_size) && (NULL != host_list[id]))
{
@@ -246,13 +247,17 @@
host->username = username;
host->id = id;
host->port = (0 == port) ? 22 : port;
- if (id >= host_list_size)
+ new_size = host_list_size;
+ while (id >= new_size)
+ new_size += HOST_LIST_GROW_STEP;
+ if (new_size != host_list_size)
{
- host_list_size += HOST_LIST_GROW_STEP;
host_list = GNUNET_realloc (host_list, sizeof (struct GNUNET_TESTBED_Host)
- * host_list_size);
- (void) memset(&host_list[host_list_size - HOST_LIST_GROW_STEP],
- 0, sizeof (struct GNUNET_TESTBED_Host) * host_list_size);
+ * new_size);
+ (void) memset(&host_list[host_list_size], 0,
+ sizeof (struct GNUNET_TESTBED_Host) *
+ (new_size - host_list_size));
+ host_list_size = new_size;
}
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Adding host with id: %u\n", host->id);
@@ -322,18 +327,21 @@
GNUNET_CONTAINER_DLL_remove (host->rc_head, host->rc_tail, rc);
GNUNET_free (rc);
}
- for (id = 0; id < HOST_LIST_GROW_STEP; id++)
+ GNUNET_free (host);
+ while (host_list_size >= HOST_LIST_GROW_STEP)
{
- if (((host->id + id) >= host_list_size) ||
- (NULL != host_list[host->id + id]))
+ for (id = host_list_size - 1;
+ id > host_list_size - HOST_LIST_GROW_STEP; id--)
+ if (NULL != host_list[id])
+ break;
+ if (id != host_list_size - HOST_LIST_GROW_STEP)
break;
- }
- if (HOST_LIST_GROW_STEP == id)
- {
+ if (NULL != host_list[id])
+ break;
host_list_size -= HOST_LIST_GROW_STEP;
- host_list = GNUNET_realloc (host_list, host_list_size);
}
- GNUNET_free (host);
+ host_list = GNUNET_realloc (host_list, sizeof (struct GNUNET_TESTBED_Host) *
+ host_list_size);
}
Modified: gnunet/src/testbed/valgrind-zlib.supp
===================================================================
--- gnunet/src/testbed/valgrind-zlib.supp 2012-07-25 09:45:59 UTC (rev
22901)
+++ gnunet/src/testbed/valgrind-zlib.supp 2012-07-25 09:59:10 UTC (rev
22902)
@@ -2,6 +2,5 @@
<ZlibInflateReset2UninitJump>
Memcheck:Cond
fun:inflateReset2
- obj:*
- obj:*
-}
\ No newline at end of file
+ ...
+}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r22902 - gnunet/src/testbed,
gnunet <=