Commit 5735efee authored by Magnus Hagander's avatar Magnus Hagander

Avoid palloc before CurrentMemoryContext is set up on win32

Instead, write the unconverted output - it will be in the wrong
encoding, but at least we don't crash.

Rushabh Lathia
parent e49ad77f
......@@ -1668,10 +1668,14 @@ write_console(const char *line, int len)
/*
* WriteConsoleW() will fail of stdout is redirected, so just fall through
* to writing unconverted to the logfile in this case.
*
* Since we palloc the structure required for conversion, also fall through
* to writing unconverted if we have not yet set up CurrentMemoryContext.
*/
if (GetDatabaseEncoding() != GetPlatformEncoding() &&
!in_error_recursion_trouble() &&
!redirection_done)
!redirection_done &&
CurrentMemoryContext != NULL)
{
WCHAR *utf16;
int utf16len;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment