[ 
https://issues.apache.org/jira/browse/PROTON-1115?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alan Conway updated PROTON-1115:
--------------------------------
    Summary: c++: memory leak in ssl examples  (was: c++: memory leak in sasl 
examples)

> c++: memory leak in ssl examples
> --------------------------------
>
>                 Key: PROTON-1115
>                 URL: https://issues.apache.org/jira/browse/PROTON-1115
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: cpp-binding
>    Affects Versions: 0.12.0
>            Reporter: Alan Conway
>            Assignee: Cliff Jansen
>
> The ssl C++ examples are leaking memory, valgrind output for for ssl follows, 
> the ssl_client_certs example has the same leak.
> Putting printfs in ssl_domain_impl shows it is constructed 34 times and freed 
> 21 times. This might explain the leak, but also seems like an unreasonably 
> large number of ssl_domains for such a simple test.
> {code}
> [aconway@wallace cpp (master $=)]$ pwd; valgrind  --leak-check=full 
> ./ssl_client_cert 'amqps://127.0.0.1:19108/examples' 
> '/home/aconway/proton/examples/cpp/ssl_certs'
> /home/aconway/proton/debug/examples/cpp
> ==16788== Memcheck, a memory error detector
> ==16788== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
> ==16788== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
> ==16788== Command: ./ssl_client_cert amqps://127.0.0.1:19108/examples 
> /home/aconway/proton/examples/cpp/ssl_certs
> ==16788== 
> Inbound server connection connected via SSL.  Protocol: TLSv1/SSLv3
> Inbound client certificate identity CN=test_client
> Outgoing client connection connected via SSL.  Server certificate identity 
> CN=test_server
> Hello World!
> ==16788== 
> ==16788== HEAP SUMMARY:
> ==16788==     in use at exit: 185,521 bytes in 3,585 blocks
> ==16788==   total heap usage: 33,114 allocs, 29,529 frees, 3,858,750 bytes 
> allocated
> ==16788== 
> ==16788== 4,913 (200 direct, 4,713 indirect) bytes in 1 blocks are definitely 
> lost in loss record 775 of 780
> ==16788==    at 0x4C28C50: malloc (in 
> /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==16788==    by 0x5615997: CRYPTO_malloc (mem.c:342)
> ==16788==    by 0x56ECA43: asn1_item_ex_combine_new (tasn_new.c:179)
> ==16788==    by 0x56EF4F0: ASN1_item_ex_d2i (tasn_dec.c:390)
> ==16788==    by 0x56EFACA: ASN1_item_d2i (tasn_dec.c:146)
> ==16788==    by 0x5356AA4: ssl3_get_server_certificate (s3_clnt.c:1228)
> ==16788==    by 0x535B921: ssl3_connect (s3_clnt.c:345)
> ==16788==    by 0x5365453: ssl23_get_server_hello (s23_clnt.c:799)
> ==16788==    by 0x5365453: ssl23_connect (s23_clnt.c:228)
> ==16788==    by 0x5365DE1: ssl23_read (s23_lib.c:133)
> ==16788==    by 0x53882D4: ssl_read (bio_ssl.c:165)
> ==16788==    by 0x56BE06B: BIO_read (bio_lib.c:210)
> ==16788==    by 0x5113EB5: process_input_ssl (openssl.c:917)
> ==16788==    by 0x50FBA9A: transport_consume (transport.c:1751)
> ==16788==    by 0x50FEFEF: pn_transport_process (transport.c:2860)
> ==16788==    by 0x5103E99: pni_connection_readable (connection.c:164)
> ==16788==    by 0x510DF7D: pn_selectable_readable (selectable.c:204)
> ==16788==    by 0x51052CE: pni_handle_quiesced (iohandler.c:41)
> ==16788==    by 0x5105505: pn_iodispatch (iohandler.c:103)
> ==16788==    by 0x51037B4: pn_handler_dispatch (handler.c:102)
> ==16788==    by 0x4E84386: proton::(anonymous 
> namespace)::override_handler::on_unhandled(proton::proton_event&) 
> (container_impl.cpp:107)
> ==16788==    by 0x4EA048F: 
> proton::proton_handler::on_reactor_quiesced(proton::proton_event&) 
> (proton_handler.cpp:32)
> ==16788==    by 0x4E9F838: 
> proton::proton_event::dispatch(proton::proton_handler&) (proton_event.cpp:105)
> ==16788==    by 0x4E84210: proton::(anonymous 
> namespace)::handler_context::dispatch(pn_handler_t*, pn_event_t*, 
> pn_event_type_t) (container_impl.cpp:71)
> ==16788==    by 0x51037B4: pn_handler_dispatch (handler.c:102)
> ==16788==    by 0x51030F4: pn_reactor_process (reactor.c:404)
> ==16788==    by 0x51034DF: pn_reactor_run (reactor.c:480)
> ==16788==    by 0x4EA1993: proton::reactor::run() (reactor.cpp:36)
> ==16788==    by 0x4E83F11: proton::container::run() (container.cpp:64)
> ==16788==    by 0x405B0D: main (ssl_client_cert.cpp:137)
> ==16788== 
> ==16788== 4,913 (200 direct, 4,713 indirect) bytes in 1 blocks are definitely 
> lost in loss record 776 of 780
> ==16788==    at 0x4C28C50: malloc (in 
> /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==16788==    by 0x5615997: CRYPTO_malloc (mem.c:342)
> ==16788==    by 0x56ECA43: asn1_item_ex_combine_new (tasn_new.c:179)
> ==16788==    by 0x56EF4F0: ASN1_item_ex_d2i (tasn_dec.c:390)
> ==16788==    by 0x56EFACA: ASN1_item_d2i (tasn_dec.c:146)
> ==16788==    by 0x5353E54: ssl3_get_client_certificate (s3_srvr.c:3230)
> ==16788==    by 0x53556C7: ssl3_accept (s3_srvr.c:593)
> ==16788==    by 0x5361447: ssl3_read_bytes (s3_pkt.c:1206)
> ==16788==    by 0x535DA03: ssl3_read_internal (s3_lib.c:4416)
> ==16788==    by 0x53882D4: ssl_read (bio_ssl.c:165)
> ==16788==    by 0x56BE06B: BIO_read (bio_lib.c:210)
> ==16788==    by 0x5113EB5: process_input_ssl (openssl.c:917)
> ==16788==    by 0x50FBA9A: transport_consume (transport.c:1751)
> ==16788==    by 0x50FEFEF: pn_transport_process (transport.c:2860)
> ==16788==    by 0x5103E99: pni_connection_readable (connection.c:164)
> ==16788==    by 0x510DF7D: pn_selectable_readable (selectable.c:204)
> ==16788==    by 0x51052CE: pni_handle_quiesced (iohandler.c:41)
> ==16788==    by 0x5105505: pn_iodispatch (iohandler.c:103)
> ==16788==    by 0x51037B4: pn_handler_dispatch (handler.c:102)
> ==16788==    by 0x4E84386: proton::(anonymous 
> namespace)::override_handler::on_unhandled(proton::proton_event&) 
> (container_impl.cpp:107)
> ==16788==    by 0x4EA048F: 
> proton::proton_handler::on_reactor_quiesced(proton::proton_event&) 
> (proton_handler.cpp:32)
> ==16788==    by 0x4E9F838: 
> proton::proton_event::dispatch(proton::proton_handler&) (proton_event.cpp:105)
> ==16788==    by 0x4E84210: proton::(anonymous 
> namespace)::handler_context::dispatch(pn_handler_t*, pn_event_t*, 
> pn_event_type_t) (container_impl.cpp:71)
> ==16788==    by 0x51037B4: pn_handler_dispatch (handler.c:102)
> ==16788==    by 0x51030F4: pn_reactor_process (reactor.c:404)
> ==16788==    by 0x51034DF: pn_reactor_run (reactor.c:480)
> ==16788==    by 0x4EA1993: proton::reactor::run() (reactor.cpp:36)
> ==16788==    by 0x4E83F11: proton::container::run() (container.cpp:64)
> ==16788==    by 0x405B0D: main (ssl_client_cert.cpp:137)
> ==16788== 
> ==16788== LEAK SUMMARY:
> ==16788==    definitely lost: 400 bytes in 2 blocks
> ==16788==    indirectly lost: 9,426 bytes in 184 blocks
> ==16788==      possibly lost: 0 bytes in 0 blocks
> ==16788==    still reachable: 175,695 bytes in 3,399 blocks
> ==16788==         suppressed: 0 bytes in 0 blocks
> ==16788== Reachable blocks (those to which a pointer was found) are not shown.
> ==16788== To see them, rerun with: --leak-check=full --show-leak-kinds=all
> ==16788== 
> ==16788== For counts of detected and suppressed errors, rerun with: -v
> ==16788== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to