aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_config.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-06-18 11:28:30 -0400
committerNick Mathewson <nickm@torproject.org>2013-06-18 11:28:30 -0400
commit9f8e672b50e07dcdfee1ba74e7f44570edaf0fe2 (patch)
treea4cbb674377b85ec2bf5101df40bd50dabf1bccb /src/test/test_config.c
parentb5d1fded3dfa836ef1f45f6acb74971f75d5caa9 (diff)
downloadtor-9f8e672b50e07dcdfee1ba74e7f44570edaf0fe2.tar
tor-9f8e672b50e07dcdfee1ba74e7f44570edaf0fe2.tar.gz
Fix a couple of resource leaks in test_config.c
Spotted by Coverity Scan. Not in any released Tor.
Diffstat (limited to 'src/test/test_config.c')
-rw-r--r--src/test/test_config.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/test/test_config.c b/src/test/test_config.c
index 2a23e33a8..ad30cdf78 100644
--- a/src/test/test_config.c
+++ b/src/test/test_config.c
@@ -193,7 +193,7 @@ test_config_check_or_create_data_subdir(void *arg)
or_options_t *options = get_options_mutable();
char *datadir = options->DataDirectory = tor_strdup(get_fname("datadir-0"));
const char *subdir = "test_stats";
- const char *subpath = get_datadir_fname(subdir);
+ char *subpath = get_datadir_fname(subdir);
struct stat st;
int r;
#if !defined (_WIN32) || defined (WINCE)
@@ -237,6 +237,7 @@ test_config_check_or_create_data_subdir(void *arg)
done:
rmdir(subpath);
tor_free(datadir);
+ tor_free(subpath);
}
static void
@@ -261,8 +262,7 @@ test_config_write_to_data_subdir(void *arg)
"accusam et justo duo dolores et\n"
"ea rebum. Stet clita kasd gubergren, no sea takimata\n"
"sanctus est Lorem ipsum dolor sit amet.";
- const char* subpath = get_datadir_fname(subdir);
- const char* filepath = get_datadir_fname2(subdir, fname);
+ char* filepath = get_datadir_fname2(subdir, fname);
(void)arg;
#if defined (_WIN32) && !defined (WINCE)
@@ -286,9 +286,9 @@ test_config_write_to_data_subdir(void *arg)
done:
remove(filepath);
- rmdir(subpath);
rmdir(options->DataDirectory);
tor_free(datadir);
+ tor_free(filepath);
}
/* Test helper function: Make sure that a bridge line gets parsed