summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/logging.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/common/logging.c b/src/common/logging.c
index f247554a32b..895da7150e7 100644
--- a/src/common/logging.c
+++ b/src/common/logging.c
@@ -216,6 +216,8 @@ pg_log_generic_v(enum pg_log_level level, const char *pg_restrict fmt, va_list a
buf = pg_malloc_extended(required_len, MCXT_ALLOC_NO_OOM);
+ errno = save_errno; /* malloc might change errno */
+
if (!buf)
{
/* memory trouble, just print what we can and get out of here */