1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-20 05:03:10 +03:00

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
This commit is contained in:
Magnus Hagander
2011-04-01 19:58:36 +02:00
parent eff933531e
commit 7b99cfbe56

View File

@ -1658,10 +1658,14 @@ write_console(const char *line, int len)
/* /*
* WriteConsoleW() will fail of stdout is redirected, so just fall through * WriteConsoleW() will fail of stdout is redirected, so just fall through
* to writing unconverted to the logfile in this case. * 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() && if (GetDatabaseEncoding() != GetPlatformEncoding() &&
!in_error_recursion_trouble() && !in_error_recursion_trouble() &&
!redirection_done) !redirection_done &&
CurrentMemoryContext != NULL)
{ {
WCHAR *utf16; WCHAR *utf16;
int utf16len; int utf16len;