Author: hbelusca Date: Sun Feb 9 11:17:29 2014 New Revision: 62065
URL: http://svn.reactos.org/svn/reactos?rev=62065&view=rev Log: [MSGINA]: Fix a memory leak. Caught by mudhead. CORE-7871 #resolve #comment Fixed in rev.62065, thanks.
Modified: trunk/reactos/dll/win32/msgina/gui.c
Modified: trunk/reactos/dll/win32/msgina/gui.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/msgina/gui.c?rev=... ============================================================================== --- trunk/reactos/dll/win32/msgina/gui.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/msgina/gui.c [iso-8859-1] Sun Feb 9 11:17:29 2014 @@ -110,7 +110,13 @@
if (!pgContext->hStatusWindow) { - msg = (PDISPLAYSTATUSMSG)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DISPLAYSTATUSMSG)); + /* + * If everything goes correctly, 'msg' is freed + * by the 'StartupWindowThread' thread. + */ + msg = (PDISPLAYSTATUSMSG)HeapAlloc(GetProcessHeap(), + HEAP_ZERO_MEMORY, + sizeof(DISPLAYSTATUSMSG)); if(!msg) return FALSE;
@@ -120,22 +126,23 @@ msg->pMessage = pMessage; msg->hDesktop = hDesktop;
- msg->StartupEvent = CreateEventW( - NULL, - TRUE, - FALSE, - NULL); + msg->StartupEvent = CreateEventW(NULL, + TRUE, + FALSE, + NULL);
if (!msg->StartupEvent) + { + HeapFree(GetProcessHeap(), 0, msg); return FALSE; - - Thread = CreateThread( - NULL, - 0, - StartupWindowThread, - (PVOID)msg, - 0, - &ThreadId); + } + + Thread = CreateThread(NULL, + 0, + StartupWindowThread, + (PVOID)msg, + 0, + &ThreadId); if (Thread) { CloseHandle(Thread); @@ -375,7 +382,7 @@ if (!ConnectToLsa(pgContext)) { ERR("ConnectToLsa() failed\n"); - return FALSE; + goto done; }
/* Call the authentication package */