Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix memory leak with TLS1.2 compression
Leak sanitizer reports following leak for ssl-test-new subtest 4-tlsv1_2-both-compress: ==335733==ERROR: LeakSanitizer: detected memory leaks Direct leak of 17728 byte(s) in 1 object(s) allocated from: #0 0x3ff9fbba251 in malloc (/usr/lib64/libasan.so.8+0xba251) #1 0x3ff9f71744f in tls_do_uncompress ssl/record/methods/tls_common.c:868 #2 0x3ff9f7175bd in tls_default_post_process_record ssl/record/methods/tls_common.c:896 #3 0x3ff9f715ee7 in tls_get_more_records ssl/record/methods/tls_common.c:773 open-quantum-safe#4 0x3ff9f712209 in tls_read_record ssl/record/methods/tls_common.c:958 open-quantum-safe#5 0x3ff9f6ef73f in ssl3_read_bytes ssl/record/rec_layer_s3.c:1235 open-quantum-safe#6 0x3ff9f776165 in tls_get_message_header ssl/statem/statem_lib.c:1198 open-quantum-safe#7 0x3ff9f74709b in read_state_machine ssl/statem/statem.c:624 open-quantum-safe#8 0x3ff9f74709b in state_machine ssl/statem/statem.c:478 open-quantum-safe#9 0x3ff9f662e61 in SSL_do_handshake ssl/ssl_lib.c:4430 open-quantum-safe#10 0x100c55d in do_handshake_step test/helpers/handshake.c:775 open-quantum-safe#11 0x100c55d in do_connect_step test/helpers/handshake.c:1134 open-quantum-safe#12 0x100e85b in do_handshake_internal test/helpers/handshake.c:1544 open-quantum-safe#13 0x1011715 in do_handshake test/helpers/handshake.c:1738 open-quantum-safe#14 0x101d1a7 in test_handshake test/ssl_test.c:543 open-quantum-safe#15 0x1027875 in run_tests test/testutil/driver.c:370 open-quantum-safe#16 0x1008393 in main test/testutil/main.c:30 open-quantum-safe#17 0x3ff9cc2b871 in __libc_start_call_main (/usr/lib64/libc.so.6+0x2b871) open-quantum-safe#18 0x3ff9cc2b94f in __libc_start_main_alias_2 (/usr/lib64/libc.so.6+0x2b94f) open-quantum-safe#19 0x100864f (/code/openssl/test/ssl_test+0x100864f) Direct leak of 17728 byte(s) in 1 object(s) allocated from: #0 0x3ff9fbba251 in malloc (/usr/lib64/libasan.so.8+0xba251) #1 0x3ff9f71744f in tls_do_uncompress ssl/record/methods/tls_common.c:868 #2 0x3ff9f7175bd in tls_default_post_process_record ssl/record/methods/tls_common.c:896 #3 0x3ff9f715ee7 in tls_get_more_records ssl/record/methods/tls_common.c:773 open-quantum-safe#4 0x3ff9f712209 in tls_read_record ssl/record/methods/tls_common.c:958 open-quantum-safe#5 0x3ff9f6ef73f in ssl3_read_bytes ssl/record/rec_layer_s3.c:1235 open-quantum-safe#6 0x3ff9f776165 in tls_get_message_header ssl/statem/statem_lib.c:1198 open-quantum-safe#7 0x3ff9f74709b in read_state_machine ssl/statem/statem.c:624 open-quantum-safe#8 0x3ff9f74709b in state_machine ssl/statem/statem.c:478 open-quantum-safe#9 0x3ff9f662e61 in SSL_do_handshake ssl/ssl_lib.c:4430 open-quantum-safe#10 0x100c55d in do_handshake_step test/helpers/handshake.c:775 open-quantum-safe#11 0x100c55d in do_connect_step test/helpers/handshake.c:1134 open-quantum-safe#12 0x1010b09 in do_handshake_internal test/helpers/handshake.c:1550 open-quantum-safe#13 0x1011715 in do_handshake test/helpers/handshake.c:1738 open-quantum-safe#14 0x101d1a7 in test_handshake test/ssl_test.c:543 open-quantum-safe#15 0x1027875 in run_tests test/testutil/driver.c:370 open-quantum-safe#16 0x1008393 in main test/testutil/main.c:30 open-quantum-safe#17 0x3ff9cc2b871 in __libc_start_call_main (/usr/lib64/libc.so.6+0x2b871) open-quantum-safe#18 0x3ff9cc2b94f in __libc_start_main_alias_2 (/usr/lib64/libc.so.6+0x2b94f) open-quantum-safe#19 0x100864f (/code/openssl/test/ssl_test+0x100864f) SUMMARY: AddressSanitizer: 35456 byte(s) leaked in 2 allocation(s). Fix this by freeing the SSL3_RECORD structure inside the OSSL_RECORD_LAYER. Signed-off-by: Juergen Christ <jchrist@linux.ibm.com> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from openssl#19030)
- Loading branch information