From 38258d656eac1cbde8df1661d2a72eb13c88ef6e Mon Sep 17 00:00:00 2001 From: Sylvain Petreolle Date: Sat, 4 Oct 2014 13:34:19 +0000 Subject: [PATCH] [EVENTVWR] -Fix use of unitialized handle for the waiting dialog. -Allocate the size of one event for each event, not the amount of all events. svn path=/trunk/; revision=64520 --- reactos/base/applications/mscutils/eventvwr/eventvwr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/reactos/base/applications/mscutils/eventvwr/eventvwr.c b/reactos/base/applications/mscutils/eventvwr/eventvwr.c index ab71fb9d7b3..8edb7e9a1fa 100644 --- a/reactos/base/applications/mscutils/eventvwr/eventvwr.c +++ b/reactos/base/applications/mscutils/eventvwr/eventvwr.c @@ -520,7 +520,7 @@ BOOL QueryEventMessages(LPWSTR lpMachineName, LPWSTR lpLogName) { - HWND hwndDlg; + HWND hwndDlg=0; HANDLE hEventLog; EVENTLOGRECORD *pevlr; DWORD dwRead, dwNeeded, dwThisRecord, dwTotalRecords = 0, dwCurrentRecord = 0, dwRecordsToRead = 0, dwFlags, dwMaxLength; @@ -599,7 +599,7 @@ QueryEventMessages(LPWSTR lpMachineName, while (dwCurrentRecord < dwTotalRecords) { - pevlr = HeapAlloc(GetProcessHeap(), 0, sizeof(EVENTLOGRECORD) * dwTotalRecords); + pevlr = HeapAlloc(GetProcessHeap(), 0, sizeof(EVENTLOGRECORD)); g_RecordPtrs[dwCurrentRecord] = pevlr; bResult = ReadEventLog(hEventLog, // Event log handle @@ -713,7 +713,8 @@ QueryEventMessages(LPWSTR lpMachineName, } // All events loaded - EndDialog(hwndDlg, 0); + if(hwndDlg) + EndDialog(hwndDlg, 0); StringCchPrintfExW(szWindowTitle, sizeof(szWindowTitle) / sizeof(WCHAR),