From: Juergen Christ Date: Wed, 10 Aug 2022 16:02:49 +0000 (+0200) Subject: Fix asan finding in bio_tfo_test X-Git-Tag: openssl-3.2.0-alpha1~2291 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d272ef5372a16924a5804b74a76491b1bc8529b5;p=thirdparty%2Fopenssl.git Fix asan finding in bio_tfo_test Running bio_tfo_test under asan yields ==172342==ERROR: LeakSanitizer: detected memory leaks Direct leak of 380 byte(s) in 5 object(s) allocated from: #0 0x3ff89bba251 in malloc (/lib64/libasan.so.8+0xba251) #1 0x3ff88cf9fd5 in gaih_inet.constprop.0 (/lib64/libc.so.6+0xf9fd5) #2 0x3ff88cfaf6f in getaddrinfo (/lib64/libc.so.6+0xfaf6f) #3 0x3ff89ba52a9 in __interceptor_getaddrinfo.part.0 (/lib64/libasan.so.8+0xa52a9) #4 0x1004909 in test_fd_tfo test/bio_tfo_test.c:241 [...] and fails the test. Fix this by freeing the return addrinfo on exit. Signed-off-by: Juergen Christ Reviewed-by: Todd Short Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/18979) --- diff --git a/test/bio_tfo_test.c b/test/bio_tfo_test.c index e91c32bd329..43057e01333 100644 --- a/test/bio_tfo_test.c +++ b/test/bio_tfo_test.c @@ -400,6 +400,8 @@ err: if (errstr != NULL) BIO_printf(bio_err, "last errno: %d=%s\n", sockerr, errstr); } + if (ai != NULL) + freeaddrinfo(ai); BIO_ADDR_free(baddr); BIO_closesocket(cfd); BIO_closesocket(sfd);