diff options
author | David Goulet <dgoulet@torproject.org> | 2020-07-06 11:21:41 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2020-07-06 11:21:41 -0400 |
commit | 95fc085bf367c1559871b68b3e01f1dc084fab6a (patch) | |
tree | 5c0d48d6b725dcc4a665548ae7e3559102418d68 /src/test/test_config.c | |
parent | ac3bc88343c0cb517eae59660c16f3a6cb273f44 (diff) | |
download | tor-95fc085bf367c1559871b68b3e01f1dc084fab6a.tar.gz tor-95fc085bf367c1559871b68b3e01f1dc084fab6a.zip |
addr: Fix possible memleak in find_my_address()
Unit tests also suffered from a memleak.
Closes #40024
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/test/test_config.c')
-rw-r--r-- | src/test/test_config.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/test/test_config.c b/src/test/test_config.c index c4d6a6efcd..045dbde0d8 100644 --- a/src/test/test_config.c +++ b/src/test/test_config.c @@ -1334,6 +1334,7 @@ test_config_find_my_address_mixed(void *arg) retval = find_my_address(options, AF_INET, LOG_NOTICE, &resolved_addr, &method_used, &hostname_out); VALIDATE_FOUND_ADDRESS(true, "RESOLVED", "www.torproject.org.v4"); + tor_free(hostname_out); /* IPv6 address should be found and considered resolved. */ tor_addr_parse(&test_addr, "0101::0101"); @@ -1382,14 +1383,15 @@ test_config_find_my_address_mixed(void *arg) retval = find_my_address(options, AF_INET, LOG_NOTICE, &resolved_addr, &method_used, &hostname_out); VALIDATE_FOUND_ADDRESS(true, "RESOLVED", "www.torproject.org.v4"); + tor_free(hostname_out); /* IPv6 address should be found and considered resolved. */ tor_addr_parse(&test_addr, "0101::0101"); retval = find_my_address(options, AF_INET6, LOG_NOTICE, &resolved_addr, &method_used, &hostname_out); VALIDATE_FOUND_ADDRESS(true, "CONFIGURED", NULL); - CLEANUP_FOUND_ADDRESS; + UNMOCK(tor_addr_lookup); done: |