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

Memory leaks using QStringToBSTR inproperly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.1.0
    • 5.0.2
    • ActiveX Support
    • None
    • Win 7 x64 SP1, VS 2010 SP1

    Description

      There are several calls to functions that expect parameters as a pointer to OLESTR. qaxserverbase.cpp code (at least qaxserverbase.cpp, maybe there are other ones) utilizes such calls as follows (this is one example):

      hr = m_spInPlaceFrame->SetActiveObject(this, QStringToBSTR(class_name));

      Here QStringToBSTR is called, which allocates memory, which in turn never gets freed. But, actually, such functions expect LPCOLESTR:

      virtual HRESULT STDMETHODCALLTYPE SetActiveObject(
      /* [unique][in] */ _RPC_in_opt IOleInPlaceActiveObject *pActiveObject,
      /* [unique][string][in] */ _RPC_in_opt_string LPCOLESTR pszObjName) = 0;

      OLESTR is not a BSTR, this is just WCHAR (WTypes.h from Win SDK):

      #define OLESTR(str) L##str

      So no allocations (call of QStringToBSTR) are needed, and therefore no leaks will occur.

      Attachments

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

        Activity

          People

            jbornema Joerg Bornemann
            zandr Andrei Zakharov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes