aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/or/networkstatus.c3
-rw-r--r--src/or/networkstatus.h4
-rw-r--r--src/test/test_dir.c14
3 files changed, 14 insertions, 7 deletions
diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c
index ef450073e..90918d4fe 100644
--- a/src/or/networkstatus.c
+++ b/src/or/networkstatus.c
@@ -10,6 +10,7 @@
* client or cache.
*/
+#define NETWORKSTATUS_PRIVATE
#include "or.h"
#include "channel.h"
#include "circuitmux.h"
@@ -183,7 +184,7 @@ router_reload_consensus_networkstatus(void)
}
/** Free all storage held by the vote_routerstatus object <b>rs</b>. */
-static void
+STATIC void
vote_routerstatus_free(vote_routerstatus_t *rs)
{
vote_microdesc_hash_t *h, *next;
diff --git a/src/or/networkstatus.h b/src/or/networkstatus.h
index 1659818f0..be0a86cdd 100644
--- a/src/or/networkstatus.h
+++ b/src/or/networkstatus.h
@@ -99,5 +99,9 @@ document_signature_t *document_signature_dup(const document_signature_t *sig);
void networkstatus_free_all(void);
int networkstatus_get_weight_scale_param(networkstatus_t *ns);
+#ifdef NETWORKSTATUS_PRIVATE
+STATIC void vote_routerstatus_free(vote_routerstatus_t *rs);
+#endif
+
#endif
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index 78583fc19..90667e9a4 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -11,6 +11,7 @@
#define ROUTER_PRIVATE
#define ROUTERLIST_PRIVATE
#define HIBERNATE_PRIVATE
+#define NETWORKSTATUS_PRIVATE
#include "or.h"
#include "config.h"
#include "directory.h"
@@ -1014,16 +1015,14 @@ vote_tweaks_for_v3ns(networkstatus_t *v, int voter, time_t now)
/* Monkey around with the list a bit */
vrs = smartlist_get(v->routerstatus_list, 2);
smartlist_del_keeporder(v->routerstatus_list, 2);
- tor_free(vrs->version);
- tor_free(vrs);
+ vote_routerstatus_free(vrs);
vrs = smartlist_get(v->routerstatus_list, 0);
vrs->status.is_fast = 1;
if (voter == 3) {
vrs = smartlist_get(v->routerstatus_list, 0);
smartlist_del_keeporder(v->routerstatus_list, 0);
- tor_free(vrs->version);
- tor_free(vrs);
+ vote_routerstatus_free(vrs);
vrs = smartlist_get(v->routerstatus_list, 0);
memset(vrs->status.descriptor_digest, (int)'Z', DIGEST_LEN);
test_assert(router_add_to_routerlist(
@@ -1363,7 +1362,8 @@ test_a_networkstatus(
vote->dist_seconds = 300;
authority_cert_free(vote->cert);
vote->cert = authority_cert_dup(cert2);
- vote->net_params = smartlist_new();
+ SMARTLIST_FOREACH(vote->net_params, char *, c, tor_free(c));
+ smartlist_clear(vote->net_params);
smartlist_split_string(vote->net_params, "bar=2000000000 circuitwindow=20",
NULL, 0, 0);
tor_free(vote->client_versions);
@@ -1407,7 +1407,8 @@ test_a_networkstatus(
vote->dist_seconds = 250;
authority_cert_free(vote->cert);
vote->cert = authority_cert_dup(cert3);
- vote->net_params = smartlist_new();
+ SMARTLIST_FOREACH(vote->net_params, char *, c, tor_free(c));
+ smartlist_clear(vote->net_params);
smartlist_split_string(vote->net_params, "circuitwindow=80 foo=660",
NULL, 0, 0);
smartlist_add(vote->supported_methods, tor_strdup("4"));
@@ -1984,6 +1985,7 @@ vote_tweaks_for_umbw(networkstatus_t *v, int voter, time_t now)
(void)now;
test_assert(v->supported_methods);
+ SMARTLIST_FOREACH(v->supported_methods, char *, c, tor_free(c));
smartlist_clear(v->supported_methods);
/* Method 17 is MIN_METHOD_TO_CLIP_UNMEASURED_BW_KB */
smartlist_split_string(v->supported_methods,