aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/parallel.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-04-16 23:23:44 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2017-04-16 23:23:44 -0400
commitb6dd1271281ce856ab774fc0b491a92878e3b501 (patch)
treeb18a6815271b38f83defd55390a30653697ed4bd /src/backend/access/transam/parallel.c
parentc7d225e227aa481c30532b2954055afd1705af31 (diff)
downloadpostgresql-b6dd1271281ce856ab774fc0b491a92878e3b501.tar.gz
postgresql-b6dd1271281ce856ab774fc0b491a92878e3b501.zip
Ensure BackgroundWorker struct contents are well-defined.
Coverity complained because bgw.bgw_extra wasn't being filled in by ApplyLauncherRegister(). The most future-proof fix is to memset the whole BackgroundWorker struct to zeroes. While at it, let's apply the same coding rule to other places that set up BackgroundWorker structs; four out of five had the same or related issues.
Diffstat (limited to 'src/backend/access/transam/parallel.c')
-rw-r--r--src/backend/access/transam/parallel.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/access/transam/parallel.c b/src/backend/access/transam/parallel.c
index 04fa2ed4550..2dad3e8a655 100644
--- a/src/backend/access/transam/parallel.c
+++ b/src/backend/access/transam/parallel.c
@@ -435,6 +435,7 @@ LaunchParallelWorkers(ParallelContext *pcxt)
oldcontext = MemoryContextSwitchTo(TopTransactionContext);
/* Configure a worker. */
+ memset(&worker, 0, sizeof(worker));
snprintf(worker.bgw_name, BGW_MAXLEN, "parallel worker for PID %d",
MyProcPid);
worker.bgw_flags =
@@ -446,7 +447,6 @@ LaunchParallelWorkers(ParallelContext *pcxt)
sprintf(worker.bgw_function_name, "ParallelWorkerMain");
worker.bgw_main_arg = UInt32GetDatum(dsm_segment_handle(pcxt->seg));
worker.bgw_notify_pid = MyProcPid;
- memset(&worker.bgw_extra, 0, BGW_EXTRALEN);
/*
* Start workers.