summaryrefslogtreecommitdiff
path: root/src/or/shared_random_state.c
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2016-07-04 12:28:28 +0300
committerGeorge Kadianakis <desnacked@riseup.net>2016-07-04 17:42:25 +0300
commitf03c74c6315598b1a7634a4dfcdebbed1e147d08 (patch)
tree05495ff568c9359301db96b499114d42de1bb99c /src/or/shared_random_state.c
parentbe78e9ff3782639b9fa72dcfa9bda559cfc83f17 (diff)
downloadtor-f03c74c6315598b1a7634a4dfcdebbed1e147d08.tar.gz
tor-f03c74c6315598b1a7634a4dfcdebbed1e147d08.zip
prop250: Plug TorVersion memleak in disk_state_reset().
Diffstat (limited to 'src/or/shared_random_state.c')
-rw-r--r--src/or/shared_random_state.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/or/shared_random_state.c b/src/or/shared_random_state.c
index 73df9c43fb..7d34334437 100644
--- a/src/or/shared_random_state.c
+++ b/src/or/shared_random_state.c
@@ -597,10 +597,16 @@ disk_state_put_srv_line(const sr_srv_t *srv, config_line_t *line)
static void
disk_state_reset(void)
{
+ /* Free allocated memory */
config_free_lines(sr_disk_state->Commit);
config_free_lines(sr_disk_state->SharedRandValues);
config_free_lines(sr_disk_state->ExtraLines);
+ tor_free(sr_disk_state->TorVersion);
+
+ /* Clean up the struct */
memset(sr_disk_state, 0, sizeof(*sr_disk_state));
+
+ /* Reset it with useful data */
sr_disk_state->magic_ = SR_DISK_STATE_MAGIC;
sr_disk_state->TorVersion = tor_strdup(get_version());
}