diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-06-28 12:27:51 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-06-28 12:36:53 -0400 |
commit | ea154a6108bae597cb37e6bc53036b6dd2ed6187 (patch) | |
tree | 53cebad71af2bf9d160f7e82f15d0e3aa9b8b3af /src/test/test_introduce.c | |
parent | 5fa2b322005d1860d39e420cb6d3ed25f5073389 (diff) | |
download | tor-ea154a6108bae597cb37e6bc53036b6dd2ed6187.tar.gz tor-ea154a6108bae597cb37e6bc53036b6dd2ed6187.zip |
Coverity: fix memory leak on error in test function.
The function make_intro_from_plaintext() in test_introduce.c would
leak memory if we ever hit a failure from our underlying crypto
functions. This kind of failure should be impossible, but it's best
to be safe here.
Bugfix on 0.2.4.1-alpha.
Diffstat (limited to 'src/test/test_introduce.c')
-rw-r--r-- | src/test/test_introduce.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/test/test_introduce.c b/src/test/test_introduce.c index 4a6d90d97e..104e973b1f 100644 --- a/src/test/test_introduce.c +++ b/src/test/test_introduce.c @@ -383,8 +383,10 @@ make_intro_from_plaintext( /* Output the cell */ *cell_out = cell; + cell = NULL; done: + tor_free(cell); return cell_len; } @@ -535,4 +537,3 @@ struct testcase_t introduce_tests[] = { INTRODUCE_LEGACY(late_parse_v3), END_OF_TESTCASES }; - |