diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2022-12-08 17:30:22 +0900 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2022-12-08 17:30:22 +0900 |
commit | 5c4b060714954a6e4571fe981b333856d2ef4a1b (patch) | |
tree | 7d26623cedb260caaac4c094c3ad436383ab12e1 /src/testing | |
parent | 715ca9df95320ccb5edc8982b264cb41774b7ccc (diff) | |
download | gnunet-5c4b060714954a6e4571fe981b333856d2ef4a1b.tar.gz gnunet-5c4b060714954a6e4571fe981b333856d2ef4a1b.zip |
TESTING: The testing API should properly take strings as const
Strings passed to the API should either be const and copied, or handled
by the caller and free'd. Looking at the transport tests currently
neither is happening. The strings are probably safer but definitely
leaked.
Changed the API to use "const" strings. Users of the testing API must
define functions that copy (and free!) strings accordingly.
Diffstat (limited to 'src/testing')
-rw-r--r-- | src/testing/gnunet-cmds-helper.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/testing/gnunet-cmds-helper.c b/src/testing/gnunet-cmds-helper.c index 624aa58eb..591ddd499 100644 --- a/src/testing/gnunet-cmds-helper.c +++ b/src/testing/gnunet-cmds-helper.c | |||
@@ -385,6 +385,7 @@ tokenizer_cb (void *cls, const struct GNUNET_MessageHeader *message) | |||
385 | LOG (GNUNET_ERROR_TYPE_ERROR, | 385 | LOG (GNUNET_ERROR_TYPE_ERROR, |
386 | "subnet node n: %s\n", | 386 | "subnet node n: %s\n", |
387 | plugin->n); | 387 | plugin->n); |
388 | // FIXME: Free? | ||
388 | node_ip = GNUNET_malloc (strlen (NODE_BASE_IP) + strlen (plugin->m) + 1); | 389 | node_ip = GNUNET_malloc (strlen (NODE_BASE_IP) + strlen (plugin->m) + 1); |
389 | strcat (node_ip, NODE_BASE_IP); | 390 | strcat (node_ip, NODE_BASE_IP); |
390 | } | 391 | } |
@@ -622,7 +623,7 @@ main (int argc, char **argv) | |||
622 | } | 623 | } |
623 | shc_chld = | 624 | shc_chld = |
624 | GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, &sighandler_child_death); | 625 | GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, &sighandler_child_death); |
625 | 626 | ||
626 | ret = GNUNET_PROGRAM_run (argc, | 627 | ret = GNUNET_PROGRAM_run (argc, |
627 | argv, | 628 | argv, |
628 | "gnunet-cmds-helper", | 629 | "gnunet-cmds-helper", |