summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2020-12-21 13:10:58 -0500
committerNick Mathewson <nickm@torproject.org>2020-12-21 13:18:20 -0500
commitf4cbcde2da39dec4be26aa1d2ffcb4d26603e1fa (patch)
tree05827b6b053bcccb2d8e54d80b5add1542cc6846 /src/test
parent5dd6304f36a9cb9b7f778abe5b84cf6a4e9890a6 (diff)
downloadtor-f4cbcde2da39dec4be26aa1d2ffcb4d26603e1fa.tar.gz
tor-f4cbcde2da39dec4be26aa1d2ffcb4d26603e1fa.zip
test: Fix memleak in test/load_stats_file
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test_stats.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/test/test_stats.c b/src/test/test_stats.c
index 7262477d77..d45afc7b15 100644
--- a/src/test/test_stats.c
+++ b/src/test/test_stats.c
@@ -515,6 +515,7 @@ test_load_stats_file(void *arg)
tt_str_op(read_file_content, OP_EQ, content);
/* Load hidserv-stats. */
+ tor_free(fname);
fname = get_datadir_fname("hidserv-stats");
tt_assert(fname);
tor_free(read_file_content);
@@ -524,7 +525,6 @@ test_load_stats_file(void *arg)
"bin_size=1024\n"
"hidserv-dir-onions-seen 53 delta_f=8 epsilon=0.30 bin_size=8\n");
write_str_to_file(fname, read_file_content, 0);
- tor_free(fname);
tor_free(content);
ret = load_stats_file("hidserv-stats", "hidserv-stats-end", 1607874000,
&content);
@@ -532,6 +532,7 @@ test_load_stats_file(void *arg)
tt_str_op(read_file_content, OP_EQ, content);
/* Load dirreq-stats. */
+ tor_free(fname);
fname = get_datadir_fname("dirreq-stats");
tt_assert(fname);
tor_free(read_file_content);
@@ -546,7 +547,6 @@ test_load_stats_file(void *arg)
"d1=133653,d2=221050,q1=261242,d3=300622,d4=399758,md=539051,d6=721322,"
"d7=959866,q3=1103363,d8=1302035,d9=2046125,max=113404000\n");
write_str_to_file(fname, read_file_content, 0);
- tor_free(fname);
tor_free(content);
ret = load_stats_file("dirreq-stats", "dirreq-stats-end", 1607874000,
&content);
@@ -554,6 +554,7 @@ test_load_stats_file(void *arg)
tt_str_op(read_file_content, OP_EQ, content);
/* Attempt to load future-stats file not starting with timestamp tag. */
+ tor_free(fname);
fname = get_datadir_fname("future-stats");
tt_assert(fname);
tor_free(read_file_content);
@@ -561,7 +562,6 @@ test_load_stats_file(void *arg)
"future-stuff-at-file-start\n"
"future-stats 2020-12-13 15:48:53 (86400 s)\n");
write_str_to_file(fname, read_file_content, 0);
- tor_free(fname);
tor_free(content);
ret = load_stats_file("future-stats", "future-stats", 1607874000, &content);
tt_int_op(ret, OP_EQ, 1);