aboutsummaryrefslogtreecommitdiff
path: root/src/test/test_stats.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2020-08-01 09:29:08 -0400
committerNick Mathewson <nickm@torproject.org>2020-08-01 09:29:08 -0400
commitefe8a988172422285762459e820d3cbcce5a6b10 (patch)
treef69f0b217613aa7ad7c791904806aade78ca252a /src/test/test_stats.c
parent700e8a8bb070d20ce6febde0c20dd9acde911856 (diff)
downloadtor-efe8a988172422285762459e820d3cbcce5a6b10.tar.gz
tor-efe8a988172422285762459e820d3cbcce5a6b10.zip
Fix a leak-on-failure on test_get_bandwidth_lines()
Spotted by coverity. This is CID 1465571.
Diffstat (limited to 'src/test/test_stats.c')
-rw-r--r--src/test/test_stats.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/test/test_stats.c b/src/test/test_stats.c
index ecf8f9a7d5..b6849b0b6d 100644
--- a/src/test/test_stats.c
+++ b/src/test/test_stats.c
@@ -452,7 +452,7 @@ static void
test_get_bandwidth_lines(void *arg)
{
(void) arg;
- char *str, *checkstr;
+ char *str = NULL, *checkstr = NULL;
char t[ISO_TIME_LEN+1];
int len = (67+MAX_HIST_VALUE_LEN)*4;
checkstr = tor_malloc_zero(len);
@@ -486,7 +486,9 @@ test_get_bandwidth_lines(void *arg)
"2048,29696,14336,59392,29696\n",
t, t, t, t);
test_get_bw_lines(str, checkstr);
+
done:
+ tor_free(str);
tor_free(checkstr);
bwhist_free_all();
}