diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2023-12-01 22:30:08 +0200 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2023-12-01 22:30:08 +0200 |
commit | b19890d49d122257ddcdb7ab2c5038f5075906c1 (patch) | |
tree | fa3831c7d1e6b5a162b0dbbf03def3dbc316a81d /src | |
parent | 0d93ce31a584ff454f39df9f94f84376756e074b (diff) |
Silence Valgrind complaint with EXEC_BACKEND
The padding bytes written to the backend params file were
uninitialized. That's harmless because we don't access the padding
bytes when we read the file back in, but Valgrind doesn't know
that. In any case, clear the padding bytes to make Valgrind happy.
Reported-by: Alexander Lakhin
Discussion: https://www.postgresql.org/message-id/014768ed-8b39-c44f-b07c-098c87b1644c@gmail.com
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/postmaster/postmaster.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 7a5cd06c5c9..ccc12f91a16 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -4490,6 +4490,14 @@ internal_forkexec(int argc, char *argv[], Port *port) BackendParameters param; FILE *fp; + /* + * Make sure padding bytes are initialized, to prevent Valgrind from + * complaining about writing uninitialized bytes to the file. This isn't + * performance critical, and the win32 implementation initializes the + * padding bytes to zeros, so do it even when not using Valgrind. + */ + memset(¶m, 0, sizeof(BackendParameters)); + if (!save_backend_variables(¶m, port)) return -1; /* log made by save_backend_variables */ |