diff options
author | Sebastian Hahn <sebastian@torproject.org> | 2011-06-08 21:35:26 +0200 |
---|---|---|
committer | Sebastian Hahn <sebastian@torproject.org> | 2011-06-08 21:35:26 +0200 |
commit | f30327449009a7f00b0f5c2bd09a7eff615df3dd (patch) | |
tree | 170ea2cda07a03276151a33073e1fef8f34bbeda /src/or | |
parent | 680646e0de29454f92d57bc3a4895d75c95e158c (diff) | |
download | tor-f30327449009a7f00b0f5c2bd09a7eff615df3dd.tar tor-f30327449009a7f00b0f5c2bd09a7eff615df3dd.tar.gz |
Fix a rare memleak during stats writing
If rep_hist_buffer_stats_write() was called unitinitalized, we'd leak
memory.
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/rephist.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/or/rephist.c b/src/or/rephist.c index 242fe81d5..54593a06c 100644 --- a/src/or/rephist.c +++ b/src/or/rephist.c @@ -2451,8 +2451,8 @@ rep_hist_buffer_stats_write(time_t now) int processed_cells[SHARES], circs_in_share[SHARES], number_of_circuits, i; double queued_cells[SHARES], time_in_queue[SHARES]; - smartlist_t *str_build = smartlist_create(); - char *str = NULL, *buf=NULL; + smartlist_t *str_build = NULL; + char *str = NULL, *buf = NULL; circuit_t *circ; if (!start_of_buffer_stats_interval) @@ -2460,6 +2460,8 @@ rep_hist_buffer_stats_write(time_t now) if (start_of_buffer_stats_interval + WRITE_STATS_INTERVAL > now) goto done; /* Not ready to write */ + str_build = smartlist_create(); + /* add current circuits to stats */ for (circ = _circuit_get_global_list(); circ; circ = circ->next) rep_hist_buffer_stats_add_circ(circ, now); |