diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2024-07-30 22:05:51 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2024-07-30 22:05:51 +0300 |
commit | 6151cb7876136ad23748f4f724309166bbfad3e0 (patch) | |
tree | 01a66ff1d3aa8b0ce5f40f6fd7962d23e705cc46 /src/backend/access/transam/xlog.c | |
parent | 5bf948d564e36553d2a1cda3244a52d054238af4 (diff) | |
download | postgresql-6151cb7876136ad23748f4f724309166bbfad3e0.tar.gz postgresql-6151cb7876136ad23748f4f724309166bbfad3e0.zip |
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
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index f86f4b5c4b7..75463e153ec 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -5168,9 +5168,9 @@ BootStrapXLOG(uint32 data_checksum_version) static char * str_time(pg_time_t tnow) { - static char buf[128]; + char *buf = palloc(128); - pg_strftime(buf, sizeof(buf), + pg_strftime(buf, 128, "%Y-%m-%d %H:%M:%S %Z", pg_localtime(&tnow, log_timezone)); |