aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_hs.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-12-05 08:13:14 -0500
committerNick Mathewson <nickm@torproject.org>2016-12-05 08:13:14 -0500
commitf7e8bd640a3c5e2227f991ea9ffe0fef3510d86d (patch)
tree8febca69235e691b5400da17bb85401ae6f0dab2 /src/test/test_hs.c
parent6eb1b4bd9cbf16339b30c2531dd1997291cc0d4c (diff)
parent42ec60ecfbff39c454945bc52def0df196ec38b8 (diff)
downloadtor-f7e8bd640a3c5e2227f991ea9ffe0fef3510d86d.tar.gz
tor-f7e8bd640a3c5e2227f991ea9ffe0fef3510d86d.zip
Merge branch 'maint-0.2.9'
Diffstat (limited to 'src/test/test_hs.c')
-rw-r--r--src/test/test_hs.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/test/test_hs.c b/src/test/test_hs.c
index 1ef1551b65..6fadeeead2 100644
--- a/src/test/test_hs.c
+++ b/src/test/test_hs.c
@@ -550,6 +550,7 @@ test_single_onion_poisoning(void *arg)
rend_service_t *service_2 = tor_malloc_zero(sizeof(rend_service_t));
char *dir2 = tor_strdup(get_fname_rnd("test_hs_dir2"));
smartlist_t *services = smartlist_new();
+ char *poison_path = NULL;
/* No services, no service to verify, no problem! */
mock_options->HiddenServiceSingleHopMode = 0;
@@ -578,8 +579,8 @@ test_single_onion_poisoning(void *arg)
tt_assert(ret == 0);
}
- service_1->directory = dir1;
- service_2->directory = dir2;
+ service_1->directory = tor_strdup(dir1);
+ service_2->directory = tor_strdup(dir2);
/* The services own the directory pointers now */
dir1 = dir2 = NULL;
/* Add port to service 1 */
@@ -696,6 +697,7 @@ test_single_onion_poisoning(void *arg)
/* Now add the second service: it has no key and no poison file */
ret = rend_service_check_dir_and_add(services, mock_options, service_2, 0);
+ tt_assert(ret == 0);
/* A new service, and an existing poisoned service. Not ok. */
mock_options->HiddenServiceSingleHopMode = 0;
@@ -715,9 +717,9 @@ test_single_onion_poisoning(void *arg)
/* Now remove the poisoning from the first service, and we have the opposite
* problem. */
- char *poison_path = rend_service_sos_poison_path(service_1);
+ poison_path = rend_service_sos_poison_path(service_1);
+ tt_assert(poison_path);
ret = unlink(poison_path);
- tor_free(poison_path);
tt_assert(ret == 0);
/* Unpoisoned service directories with previous keys are ok, as are empty
@@ -774,9 +776,10 @@ test_single_onion_poisoning(void *arg)
tt_assert(ret == 0);
done:
+ /* The test harness deletes the directories at exit */
+ tor_free(poison_path);
tor_free(dir1);
tor_free(dir2);
- /* The test harness deletes the directories at exit */
smartlist_free(services);
rend_service_free(service_1);
rend_service_free(service_2);