aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_dir_handle_get.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/test/test_dir_handle_get.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/test/test_dir_handle_get.c')
-rw-r--r--src/test/test_dir_handle_get.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/test/test_dir_handle_get.c b/src/test/test_dir_handle_get.c
index e57bd02584..edfd0c74e1 100644
--- a/src/test/test_dir_handle_get.c
+++ b/src/test/test_dir_handle_get.c
@@ -479,8 +479,7 @@ static or_options_t *mock_options = NULL;
static void
init_mock_options(void)
{
- mock_options = tor_malloc(sizeof(or_options_t));
- memset(mock_options, 0, sizeof(or_options_t));
+ mock_options = options_new();
mock_options->TestingTorNetwork = 1;
mock_options->DataDirectory = tor_strdup(get_fname_rnd("datadir_tmp"));
mock_options->CacheDirectory = tor_strdup(mock_options->DataDirectory);