Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-6504

Potential memory leak in QSslSocket

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 4.7.0
    • 4.6.0
    • Network
    • None
    • d4d7f3575c229848f08c7df75a1281755d6c41a8

    Description

      Steps to reproduce:

      Extract and build the attached example.
      run:
      $valgrind --leak-check=full --num-callers=20 ./server -e 2> leak.log
      and in another terminal:
      $openssl s_client -cert server.crt -key server.key -CAfile cacert.pem -connect localhost:14567

      the handshake should fail, then break the server.

      There might be a minor leak with the memory allocated on EVP_PKEY_new not being freed.

      ==7493== 40 bytes in 1 blocks are definitely lost in loss record 521 of 773
      ==7493== at 0x4C25153: malloc (vg_replace_malloc.c:195)
      ==7493== by 0x7639F91: CRYPTO_malloc (mem.c:304)
      ==7493== by 0x76A2A19: EVP_PKEY_new (p_lib.c:317)
      ==7493== by 0x4EE5A53: QSslSocketBackendPrivate::initSslContext() (qsslsocket_openssl.cpp:314)
      ==7493== by 0x4EE7608: QSslSocketBackendPrivate::startServerEncryption() (qsslsocket_openssl.cpp:532)
      ==7493== by 0x40351D: Client::Client(int, QObject*) (in /home/zomps/svn/server-ssl/src/server)
      ==7493== by 0x403608: Server::incomingConnection(int) (in /home/zomps/svn/server-ssl/src/server)
      ==7493== by 0x4ECDF77: QTcpServerPrivate::readNotification() (qtcpserver.cpp:217)
      ==7493== by 0x4EB8F00: QReadNotifier::event(QEvent*) (qnativesocketengine.cpp:1036)
      ==7493== by 0x5289C2B: QCoreApplication::notifyInternal(QObject*, QEvent*) (qcoreapplication.cpp:610)
      ==7493== by 0x52B2429: socketNotifierSourceDispatch(_GSource*, int (void*), void*) (qcoreapplication.h:213)
      ==7493== by 0x6911BBD: g_main_context_dispatch (in /lib/libglib-2.0.so.0.2200.2)
      ==7493== by 0x6915587: ??? (in /lib/libglib-2.0.so.0.2200.2)
      ==7493== by 0x69156AF: g_main_context_iteration (in /lib/libglib-2.0.so.0.2200.2)
      ==7493== by 0x52B21A5: QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (qeventdispatcher_glib.cpp:327)
      ==7493== by 0x5288531: QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (qeventloop.cpp:149)
      ==7493== by 0x5288903: QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (qeventloop.cpp:201)
      ==7493== by 0x528AAB8: QCoreApplication::exec() (qcoreapplication.cpp:888)
      ==7493== by 0x4029EF: main (in /home/zomps/svn/server-ssl/src/server)

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              mgoetz Markus Goetz (Inactive)
              ntg Pierre Rossi
              Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes