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

QaxServerMain WinMain memory leak

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.6.0 Beta
    • 5.6.0 Alpha
    • ActiveX Support
    • None
    • Visual Studio 2012 (move semantics enabled)
    •  (qtactive/5.6, 2.11.2015, 5.6b) 4abafae33c9b911e8458f31b7611991d9430217b

    Description

      The QVector<T>::append(T&&) method introduced in https://codereview.qt-project.org/#/c/121810/ leaks memory when T=char*.

      The reason for the leak seem to be that the placement new neither takes over ownership, nor deletes the input rvalue reference.

      How to reproduce (in Visual Studio 2012):

      • Build & run the attached reproducer.
      • Observe a leak(s) listed in the Visual studio "Output" windows on program termination.
      • Restart application.
      • Break the program early and assign " {, , msvcr110d.dll}

        _crtBreakAlloc" to the leaked allocation number in the debugger (more info in https://msdn.microsoft.com/en-us/library/x98tx3cf.aspx).

      • Observer that debugger breaks in _strdup call entered as argument to QVector<char*>::append(T&&).

      Leaking call stack (from command-line argument handing at startup):

      • msvcr110d.dll!_strdup(const char * string=0x0054b980) Line 48 C
      • Qt5Cored.dll!qWinMain(HINSTANCE__ * instance=0x01380000, HINSTANCE__ * prevInstance=0x00000000, char * cmdParam=0x00544668, int cmdShow=10, int & argc=1, QVector<char *> & argv= {...}

        ) Line 157 C++

      • QtPluginHost.exe!WinMain(HINSTANCE__ * hInstance=0x01380000, HINSTANCE__ * hPrevInstance=0x00000000, char * __formal=0x004f6b0e, int nShowCmd=10) Line 248 C++
      • QtPluginHost.exe!__tmainCRTStartup() Line 528 C
      • QtPluginHost.exe!WinMainCRTStartup() Line 377 C

      Attachments

        1. QtLeak.7z
          0.8 kB
          Fredrik Orderud
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            forderud Fredrik Orderud
            forderud Fredrik Orderud
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes