Skip to content

Commit 5735efe

Browse files
committed
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
1 parent e49ad77 commit 5735efe

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/backend/utils/error/elog.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1668,10 +1668,14 @@ write_console(const char *line, int len)
16681668
/*
16691669
* WriteConsoleW() will fail of stdout is redirected, so just fall through
16701670
* to writing unconverted to the logfile in this case.
1671+
*
1672+
* Since we palloc the structure required for conversion, also fall through
1673+
* to writing unconverted if we have not yet set up CurrentMemoryContext.
16711674
*/
16721675
if (GetDatabaseEncoding() != GetPlatformEncoding() &&
16731676
!in_error_recursion_trouble() &&
1674-
!redirection_done)
1677+
!redirection_done &&
1678+
CurrentMemoryContext != NULL)
16751679
{
16761680
WCHAR *utf16;
16771681
int utf16len;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy