aboutsummaryrefslogtreecommitdiff
path: root/src/feature/dirauth
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-09-27 13:05:19 -0400
committerNick Mathewson <nickm@torproject.org>2018-09-27 13:05:19 -0400
commit8812f562a03234723871b893f269db09e78654fc (patch)
tree1961cbeddd0e702585df9507e14d04d54db530ea /src/feature/dirauth
parentde0b07c634c45297bad794567cb44ab91988b0ca (diff)
downloadtor-8812f562a03234723871b893f269db09e78654fc.tar.gz
tor-8812f562a03234723871b893f269db09e78654fc.zip
Fix a memory leak in --dump-config
When freeing a configuration object from confparse.c in dump_config(), we need to call the appropriate higher-level free function (like or_options_free()) and not just config_free(). This only happens with options (since they're the one where options_validate allocates extra stuff) and only when running --dump-config with something other than minimal (since OPTIONS_DUMP_MINIMAL doesn't hit this code). Fixes bug 27893; bugfix on 0.3.2.1-alpha.
Diffstat (limited to 'src/feature/dirauth')
-rw-r--r--src/feature/dirauth/shared_random_state.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/feature/dirauth/shared_random_state.c b/src/feature/dirauth/shared_random_state.c
index 55936a7367..38c7fd76d0 100644
--- a/src/feature/dirauth/shared_random_state.c
+++ b/src/feature/dirauth/shared_random_state.c
@@ -63,6 +63,7 @@ DUMMY_TYPECHECK_INSTANCE(sr_disk_state_t);
static int
disk_state_validate_cb(void *old_state, void *state, void *default_state,
int from_setconf, char **msg);
+static void disk_state_free_cb(void *);
/* Array of variables that are saved to disk as a persistent state. */
static config_var_t state_vars[] = {
@@ -96,6 +97,7 @@ static const config_format_t state_format = {
NULL,
state_vars,
disk_state_validate_cb,
+ disk_state_free_cb,
&state_extra_var,
};
@@ -342,6 +344,12 @@ disk_state_validate_cb(void *old_state, void *state, void *default_state,
return 0;
}
+static void
+disk_state_free_cb(void *state)
+{
+ disk_state_free_(state);
+}
+
/* Parse the Commit line(s) in the disk state and translate them to the
* the memory state. Return 0 on success else -1 on error. */
static int