diff options
author | Magnus Hagander <magnus@hagander.net> | 2011-04-01 19:58:36 +0200 |
---|---|---|
committer | Magnus Hagander <magnus@hagander.net> | 2011-04-01 19:59:44 +0200 |
commit | 5735efee15540765315aa8c1a230575e756037f7 (patch) | |
tree | 5b60487e70d70414dd831f647af3e1de7562e270 /src | |
parent | e49ad77ff958b380ea6fa08c72e2dce97ac56c6b (diff) | |
download | postgresql-5735efee15540765315aa8c1a230575e756037f7.tar.gz postgresql-5735efee15540765315aa8c1a230575e756037f7.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/utils/error/elog.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 5679d5b9c1a..e7bc046d870 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -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; |