summaryrefslogtreecommitdiff
path: root/src/feature/dirauth/shared_random_state.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-07-23 12:04:59 -0400
committerNick Mathewson <nickm@torproject.org>2019-08-28 09:40:53 -0400
commit47654d32497acae23aafbe3316ae73d3c00429c8 (patch)
tree9d9bb68efe2587b033eef4de945c4d887b2cfd76 /src/feature/dirauth/shared_random_state.c
parent3d1f9f583a45143c1259b8926f8c57fa57fc1efb (diff)
downloadtor-47654d32497acae23aafbe3316ae73d3c00429c8.tar.gz
tor-47654d32497acae23aafbe3316ae73d3c00429c8.zip
Refactor config free logic to use a single path.
The right way to free a config object is now to wrap config_free(), always. Instead of creating an alternative free function, objects should provide an alternative clear callback to free any fields that the configuration manager doesn't manage. This lets us simplify our code a little, and lets us extend the confparse.c code to manage additional fields in config_free.
Diffstat (limited to 'src/feature/dirauth/shared_random_state.c')
-rw-r--r--src/feature/dirauth/shared_random_state.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/src/feature/dirauth/shared_random_state.c b/src/feature/dirauth/shared_random_state.c
index 21bf3c1226..fac1efc54d 100644
--- a/src/feature/dirauth/shared_random_state.c
+++ b/src/feature/dirauth/shared_random_state.c
@@ -62,7 +62,6 @@ 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(const config_mgr_t *mgr, void *);
/* Array of variables that are saved to disk as a persistent state. */
static const config_var_t state_vars[] = {
@@ -99,7 +98,7 @@ static const config_format_t state_format = {
NULL,
state_vars,
disk_state_validate_cb,
- disk_state_free_cb,
+ NULL,
&state_extra_var,
};
@@ -361,13 +360,6 @@ disk_state_validate_cb(void *old_state, void *state, void *default_state,
return 0;
}
-static void
-disk_state_free_cb(const config_mgr_t *mgr, void *state)
-{
- (void)mgr;
- 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