[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: Fixed #7630: Memory leak in (?) finish_t
From: |
gnunet |
Subject: |
[gnunet] branch master updated: Fixed #7630: Memory leak in (?) finish_test in testing_api_loop.c |
Date: |
Tue, 07 Feb 2023 17:44:34 +0100 |
This is an automated email from the git hooks/post-receive script.
t3sserakt pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new fb61e1a7a Fixed #7630: Memory leak in (?) finish_test in
testing_api_loop.c
new 5f4f2527d Merge branch 'master' of ssh://git.gnunet.org/gnunet
fb61e1a7a is described below
commit fb61e1a7a5fbd7b8f696dd7b66b15ae7c35f9013
Author: t3sserakt <t3ss@posteo.de>
AuthorDate: Tue Feb 7 17:25:49 2023 +0100
Fixed #7630: Memory leak in (?) finish_test in testing_api_loop.c
---
src/testing/testing.h | 9 --
src/testing/testing_api_cmd_barrier.c | 1 -
.../testing_api_cmd_netjail_start_cmds_helper.c | 1 -
src/testing/testing_api_loop.c | 151 +++++++++++----------
4 files changed, 76 insertions(+), 86 deletions(-)
diff --git a/src/testing/testing.h b/src/testing/testing.h
index adcb50a13..fbd7d0d34 100644
--- a/src/testing/testing.h
+++ b/src/testing/testing.h
@@ -326,15 +326,6 @@ GNUNET_TESTING_barrier_get_node (struct
GNUNET_TESTING_Barrier *barrier,
unsigned int node_number);
-/**
- * Deleting all barriers create in the context of this interpreter.
- *
- * @param is The interpreter.
- */
-void
-TST_interpreter_delete_barriers (struct GNUNET_TESTING_Interpreter *is);
-
-
/**
* Getting a barrier from the interpreter.
*
diff --git a/src/testing/testing_api_cmd_barrier.c
b/src/testing/testing_api_cmd_barrier.c
index 118918bc4..9dd154059 100644
--- a/src/testing/testing_api_cmd_barrier.c
+++ b/src/testing/testing_api_cmd_barrier.c
@@ -141,7 +141,6 @@ barrier_cleanup (void *cls)
{
struct BarrierState *brs = cls;
- GNUNET_free (brs->barrier);
GNUNET_free (brs);
}
diff --git a/src/testing/testing_api_cmd_netjail_start_cmds_helper.c
b/src/testing/testing_api_cmd_netjail_start_cmds_helper.c
index 619392119..f1ef9fef1 100644
--- a/src/testing/testing_api_cmd_netjail_start_cmds_helper.c
+++ b/src/testing/testing_api_cmd_netjail_start_cmds_helper.c
@@ -217,7 +217,6 @@ static void
netjail_exec_cleanup (void *cls)
{
struct NetJailState *ns = cls;
- TST_interpreter_delete_barriers (ns->is);
GNUNET_free (ns);
}
diff --git a/src/testing/testing_api_loop.c b/src/testing/testing_api_loop.c
index 7d719afc0..3ff7d2957 100644
--- a/src/testing/testing_api_loop.c
+++ b/src/testing/testing_api_loop.c
@@ -239,6 +239,81 @@ GNUNET_TESTING_interpreter_lookup_command_all (
}
+int
+free_barrier_node_cb (void *cls,
+ const struct GNUNET_ShortHashCode *key,
+ void *value)
+{
+ struct FreeBarrierNodeCbCls *free_barrier_node_cb_cls = cls;
+ struct GNUNET_TESTING_NetjailNode *node = value;
+ struct GNUNET_TESTING_Barrier *barrier = free_barrier_node_cb_cls->barrier;
+ struct GNUNET_TESTING_Interpreter *is = free_barrier_node_cb_cls->is;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "free_barrier_node_cb\n");
+ if (GNUNET_NO == is->finishing)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "TST_interpreter_send_barrier_crossable\n");
+ TST_interpreter_send_barrier_crossable (is,
+ barrier->name,
+ node->node_number);
+ }
+ GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multishortmap_remove (
+ barrier->nodes, key, node));
+ return GNUNET_YES;
+}
+
+
+int
+free_barriers_cb (void *cls,
+ const struct GNUNET_ShortHashCode *key,
+ void *value)
+{
+ struct GNUNET_TESTING_Interpreter *is = cls;
+ struct GNUNET_TESTING_Barrier *barrier = value;
+ struct CommandListEntry *pos;
+ struct FreeBarrierNodeCbCls *free_barrier_node_cb_cls;
+
+ if (NULL != barrier->nodes)
+ {
+ free_barrier_node_cb_cls = GNUNET_new (struct FreeBarrierNodeCbCls);
+ free_barrier_node_cb_cls->barrier = barrier;
+ free_barrier_node_cb_cls->is = is;
+ GNUNET_CONTAINER_multishortmap_iterate (barrier->nodes,
+ free_barrier_node_cb,
+ free_barrier_node_cb_cls);
+ GNUNET_CONTAINER_multishortmap_destroy (barrier->nodes);
+ barrier->nodes = NULL;
+ }
+
+ while (NULL != (pos = barrier->cmds_head))
+ {
+ GNUNET_CONTAINER_DLL_remove (barrier->cmds_head,
+ barrier->cmds_tail,
+ pos);
+ GNUNET_free (pos);
+ }
+ GNUNET_free (barrier);
+ return GNUNET_YES;
+}
+
+
+/**
+ * Deleting all barriers create in the context of this interpreter.
+ *
+ * @param is The interpreter.
+ */
+static void
+interpreter_delete_barriers (struct GNUNET_TESTING_Interpreter *is)
+{
+ GNUNET_CONTAINER_multishortmap_iterate (is->barriers,
+ free_barriers_cb,
+ is);
+ GNUNET_CONTAINER_multishortmap_destroy (is->barriers);
+}
+
+
/**
* Finish the test run, return the final result.
*
@@ -285,6 +360,7 @@ finish_test (void *cls)
GNUNET_free (is->commands);
is->rc (is->rc_cls,
is->result);
+ interpreter_delete_barriers (is);
GNUNET_free (is->helper);
GNUNET_free (is);
}
@@ -687,32 +763,6 @@ TST_interpreter_send_barrier_crossable (struct
GNUNET_TESTING_Interpreter *is,
}
-int
-free_barrier_node_cb (void *cls,
- const struct GNUNET_ShortHashCode *key,
- void *value)
-{
- struct FreeBarrierNodeCbCls *free_barrier_node_cb_cls = cls;
- struct GNUNET_TESTING_NetjailNode *node = value;
- struct GNUNET_TESTING_Barrier *barrier = free_barrier_node_cb_cls->barrier;
- struct GNUNET_TESTING_Interpreter *is = free_barrier_node_cb_cls->is;
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "free_barrier_node_cb\n");
- if (GNUNET_NO == is->finishing)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "TST_interpreter_send_barrier_crossable\n");
- TST_interpreter_send_barrier_crossable (is,
- barrier->name,
- node->node_number);
- }
- GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_multishortmap_remove (
- barrier->nodes, key, node));
- return GNUNET_YES;
-}
-
-
/**
* Getting a barrier from the interpreter.
*
@@ -797,55 +847,6 @@ TST_interpreter_finish_attached_cmds (struct
GNUNET_TESTING_Interpreter *is,
}
-int
-free_barriers_cb (void *cls,
- const struct GNUNET_ShortHashCode *key,
- void *value)
-{
- struct GNUNET_TESTING_Interpreter *is = cls;
- struct GNUNET_TESTING_Barrier *barrier = value;
- struct CommandListEntry *pos;
- struct FreeBarrierNodeCbCls *free_barrier_node_cb_cls;
-
- if (NULL != barrier->nodes)
- {
- free_barrier_node_cb_cls = GNUNET_new (struct FreeBarrierNodeCbCls);
- free_barrier_node_cb_cls->barrier = barrier;
- free_barrier_node_cb_cls->is = is;
- GNUNET_CONTAINER_multishortmap_iterate (barrier->nodes,
- free_barrier_node_cb,
- free_barrier_node_cb_cls);
- GNUNET_CONTAINER_multishortmap_destroy (barrier->nodes);
- barrier->nodes = NULL;
- }
-
- while (NULL != (pos = barrier->cmds_head))
- {
- GNUNET_CONTAINER_DLL_remove (barrier->cmds_head,
- barrier->cmds_tail,
- pos);
- GNUNET_free (pos);
- }
- GNUNET_free (barrier);
- return GNUNET_YES;
-}
-
-
-/**
- * Deleting all barriers create in the context of this interpreter.
- *
- * @param is The interpreter.
- */
-void
-TST_interpreter_delete_barriers (struct GNUNET_TESTING_Interpreter *is)
-{
- GNUNET_CONTAINER_multishortmap_iterate (is->barriers,
- free_barriers_cb,
- is);
- GNUNET_CONTAINER_multishortmap_destroy (is->barriers);
-}
-
-
/**
* Add a barrier to the loop.
*
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: Fixed #7630: Memory leak in (?) finish_test in testing_api_loop.c,
gnunet <=