Home Dashboard Directory Help

Suspicious error handling code in CAtlExeModuleT::StartMonitor() by Dmitry Me


 as Fixed Help for as Fixed

Sign in
to vote
Type: Bug
ID: 714802
Opened: 12/20/2011 1:32:23 AM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
User(s) can reproduce this bug


This behavior is observed in version 10.0.40219.1 SP1Rel

atlbase.h contains this code in CAtlExeModuleT

HANDLE StartMonitor() throw()
    m_hEventShutdown = ::CreateEvent(NULL, false, false, NULL);
    if (m_hEventShutdown == NULL)
        return NULL;
    DWORD dwThreadID;
    HANDLE hThread = ::CreateThread(NULL, 0, MonitorProc, this, 0, &dwThreadID);
    return hThread;

Note the "if(hThread==NULL)" branch - the handle is closed, but the member variable is not set to null. This is likely an error - the handle should be set to null once closed to avoid accidential double close. If the code is actually okay then a comment explaining the idea behind the code is needed.
Sign in to post a comment.
Posted by MS-Moderator08 [Feedback Moderator] on 12/21/2011 at 6:57 PM
Thank you for submitting feedback on Visual Studio 2010 and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by MS-Moderator01 on 12/20/2011 at 1: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.