diff options
author | Mike Perry <mikeperry-git@fscked.org> | 2009-09-04 13:42:58 -0700 |
---|---|---|
committer | Mike Perry <mikeperry-git@fscked.org> | 2009-09-16 15:54:37 -0700 |
commit | 4b3bc714a3f5253470e1feab80bfd30744d34d44 (patch) | |
tree | f58c724aae334a9ffe7a8a2df22cd3b4cffda640 /src/or/circuitbuild.c | |
parent | b508e4748f42436ad1e9b05970cc4d3c5c1debfc (diff) | |
download | tor-4b3bc714a3f5253470e1feab80bfd30744d34d44.tar tor-4b3bc714a3f5253470e1feab80bfd30744d34d44.tar.gz |
Woops. Fix a couple memory leaks.
Also change the max timeout quantile to 0.98, so we can
avoid huge synthetic timeout values.
Diffstat (limited to 'src/or/circuitbuild.c')
-rw-r--r-- | src/or/circuitbuild.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 39e5a43f5..3fa446faa 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -229,6 +229,8 @@ circuit_build_times_mode(circuit_build_times_t *cbt) } } + tor_free(histogram); + return max_bin*BUILDTIME_BIN_WIDTH; } @@ -309,6 +311,8 @@ circuit_build_times_parse_state(circuit_build_times_t *cbt, if (smartlist_len(args) < 2) { *msg = tor_strdup("Unable to parse circuit build times: " "Too few arguments to CircuitBuildTime"); + SMARTLIST_FOREACH(args, char*, cp, tor_free(cp)); + smartlist_free(args); break; } else { const char *ms_str = smartlist_get(args,0); @@ -333,7 +337,10 @@ circuit_build_times_parse_state(circuit_build_times_t *cbt, circuit_build_times_add_time(cbt, ms); } N++; + SMARTLIST_FOREACH(args, char*, cp, tor_free(cp)); + smartlist_free(args); } + } circuit_build_times_shuffle_array(cbt); @@ -439,9 +446,11 @@ void circuit_build_times_add_timeout_worker(circuit_build_times_t *cbt, double quantile_cutoff) { - /* Generate 0.8-1.0... */ + /* Generate points in [cutoff, 1.0) on the CDF... We want to + * stay a bit short of 1.0 though, because longtail is + * loooooooooooooooooooooooooooooooooooooooooooooooooooong */ build_time_t gentime = circuit_build_times_generate_sample(cbt, - quantile_cutoff, 1.0); + quantile_cutoff, 0.98); if (gentime < (build_time_t)cbt->timeout*1000) { log_warn(LD_CIRC, |