Home Dashboard Directory Help
Search

CComApartment::Apartment() leaks objects on edge cases by Dmitry Me


Status: 

Closed
 as Fixed Help for as Fixed


1
0
Sign in
to vote
Type: Bug
ID: 742895
Opened: 5/21/2012 3:21:05 AM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

Currently atlbase.h contains CComApartment class that has Apartment() member function that has this code:

IUnknown* pUnk = NULL;
pdata->hRes = pdata->pfnCreateInstance(NULL, __uuidof(IUnknown), (void**)&pUnk);
if (SUCCEEDED(pdata->hRes))
    pdata->hRes = CoMarshalInterThreadInterfaceInStream(*pdata->piid, pUnk, &pdata->pStream);
if (SUCCEEDED(pdata->hRes))
{
    pUnk->Release();
ATLTRACE(atlTraceCOM, 2, _T("Object created on thread = %d\n"), GetCurrentThreadId());
}

Now if pfnCreateInstance() succeeds but CoMarshalInterThreadInterfaceInStream() fails then "Release()" is not called and the object is leaked.
Details
Sign in to post a comment.
Posted by Microsoft on 10/8/2012 at 2:17 PM
Hello Dmitry,

Thank you very much for the feedback. The problem has been fixed in next release of Visual Studio.

Windows C++ Libraries Team
Lukasz Chodorski
Posted by MS-Moderator08 [Feedback Moderator] on 5/22/2012 at 1:04 AM
Thank you for submitting feedback on Visual Studio 11 and .NET Framework. Your issue has been routed to the appropriate VS development team for review. We will contact you if we require any additional information.
Posted by MS-Moderator01 on 5/21/2012 at 3:43 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.