summaryrefslogtreecommitdiff
path: root/src/test/test_hs_client.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-09-12 17:15:52 -0400
committerNick Mathewson <nickm@torproject.org>2017-09-12 19:03:04 -0400
commit0f58e173134698a813d23288dabc22f2591e9dc2 (patch)
tree33a4f77791f3ba5eac0520d89a4cfe3807067ae5 /src/test/test_hs_client.c
parent4097d646d81310ceefbe9a3f6873aaaca6af138e (diff)
downloadtor-0f58e173134698a813d23288dabc22f2591e9dc2.tar.gz
tor-0f58e173134698a813d23288dabc22f2591e9dc2.zip
clang scan-build: Fix "dereference of null pointer" warnings
These warnings are all in the tests, and happen because something that one part of the code checks for null-ness is later dereferenced.
Diffstat (limited to 'src/test/test_hs_client.c')
-rw-r--r--src/test/test_hs_client.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/test/test_hs_client.c b/src/test/test_hs_client.c
index af5f5cb576..6714daceae 100644
--- a/src/test/test_hs_client.c
+++ b/src/test/test_hs_client.c
@@ -203,7 +203,8 @@ test_e2e_rend_circuit_setup_legacy(void *arg)
done:
connection_free_(conn);
- tor_free(TO_CIRCUIT(or_circ)->n_chan);
+ if (or_circ)
+ tor_free(TO_CIRCUIT(or_circ)->n_chan);
circuit_free(TO_CIRCUIT(or_circ));
}
@@ -212,7 +213,7 @@ static void
test_e2e_rend_circuit_setup(void *arg)
{
uint8_t ntor_key_seed[DIGEST256_LEN] = {0};
- origin_circuit_t *or_circ;
+ origin_circuit_t *or_circ = NULL;
int retval;
connection_t *conn = NULL;
@@ -272,7 +273,8 @@ test_e2e_rend_circuit_setup(void *arg)
done:
connection_free_(conn);
- tor_free(TO_CIRCUIT(or_circ)->n_chan);
+ if (or_circ)
+ tor_free(TO_CIRCUIT(or_circ)->n_chan);
circuit_free(TO_CIRCUIT(or_circ));
}