Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions win32/src/PythonService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,11 @@ static PyObject *DoLogMessage(WORD errorType, PyObject *obMsg)
DWORD errorCode = errorType == EVENTLOG_ERROR_TYPE ? PYS_E_GENERIC_ERROR : PYS_E_GENERIC_WARNING;
LPCTSTR inserts[] = {msg, NULL};
BOOL ok;
Py_BEGIN_ALLOW_THREADS ok = ReportError(errorCode, inserts, errorType);
PyWinObject_FreeWCHAR(msg);
Py_END_ALLOW_THREADS if (!ok) return PyWin_SetAPIError("RegisterEventSource/ReportEvent");
Py_BEGIN_ALLOW_THREADS
ok = ReportError(errorCode, inserts, errorType);
Py_END_ALLOW_THREADS
PyWinObject_FreeWCHAR(msg); // free msg before potentially raising error
if (!ok) return PyWin_SetAPIError("RegisterEventSource/ReportEvent");
Py_INCREF(Py_None);
return Py_None;
}
Expand Down
Loading