Skip to content

Commit 6151cb7

Browse files
committed
Replace static buf with palloc in str_time()
The function is used only once in the startup process, so the leak into current memory context is harmless. This is a tiny step in making the server thread-safe. Reviewed-by: Robert Haas Discussion: https://www.postgresql.org/message-id/7f86e06a-98c5-4ce3-8ec9-3885c8de0358@iki.fi
1 parent 5bf948d commit 6151cb7

File tree

1 file changed

+2
-2
lines changed
  • src/backend/access/transam

1 file changed

+2
-2
lines changed

src/backend/access/transam/xlog.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5168,9 +5168,9 @@ BootStrapXLOG(uint32 data_checksum_version)
51685168
static char *
51695169
str_time(pg_time_t tnow)
51705170
{
5171-
static char buf[128];
5171+
char *buf = palloc(128);
51725172

5173-
pg_strftime(buf, sizeof(buf),
5173+
pg_strftime(buf, 128,
51745174
"%Y-%m-%d %H:%M:%S %Z",
51755175
pg_localtime(&tnow, log_timezone));
51765176

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