diff options
author | George Kadianakis <desnacked@riseup.net> | 2020-01-27 17:26:47 +0200 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2020-01-28 01:08:41 +0200 |
commit | ba99287d13782048f58a88dc5d18780fad9f2034 (patch) | |
tree | 12cb01a06bca75a9563733333ec279f73dc4d53c /src/test/test_hs_ob.c | |
parent | 635f58bad23282e27fbc5833dbaae978dab25934 (diff) | |
download | tor-ba99287d13782048f58a88dc5d18780fad9f2034.tar.gz tor-ba99287d13782048f58a88dc5d18780fad9f2034.zip |
Write unittest that covers cases of INTRODUCE1 handling.
Also fix some memleaks of other OB unittests.
Diffstat (limited to 'src/test/test_hs_ob.c')
-rw-r--r-- | src/test/test_hs_ob.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/test/test_hs_ob.c b/src/test/test_hs_ob.c index c4d9d239d2..b84cef9dec 100644 --- a/src/test/test_hs_ob.c +++ b/src/test/test_hs_ob.c @@ -169,6 +169,7 @@ static void test_get_subcredentials(void *arg) { int ret; + hs_service_t *service = NULL; hs_service_config_t config; (void) arg; @@ -192,7 +193,7 @@ test_get_subcredentials(void *arg) smartlist_add(config.ob_master_pubkeys, &onion_addr_kp_1.pubkey); /* Set up an instance */ - hs_service_t *service = tor_malloc_zero(sizeof(hs_service_t)); + service = tor_malloc_zero(sizeof(hs_service_t)); service->config = config; service->desc_current = service_descriptor_new(); service->desc_next = service_descriptor_new(); @@ -234,7 +235,12 @@ test_get_subcredentials(void *arg) done: tor_free(subcreds); + smartlist_free(config.ob_master_pubkeys); + if (service) { + memset(&service->config, 0, sizeof(hs_service_config_t)); + hs_service_free(service); + } UNMOCK(networkstatus_get_live_consensus); } |