diff options
| author | Robert Haas | 2015-11-20 18:03:39 +0000 |
|---|---|---|
| committer | Robert Haas | 2015-11-20 18:03:39 +0000 |
| commit | 6c878a7553680579f287e4659592c0b874fb2377 (patch) | |
| tree | ac042140a9cfc9f476ae1f1c4d84e626dc016ee4 /src/backend/executor/nodeGather.c | |
| parent | 74d0d5f3ebed9d817ec353fb17eedb343a0ab5b4 (diff) | |
Avoid server crash when worker registration fails at execution time.
The previous coding attempts to destroy the DSM in this case, but
child nodes might have stored data there and still be holding onto
pointers in this case. So don't do that.
Also, free the reader array instead of leaking it.
Extracted from two different patch versions both by Amit Kapila.
Diffstat (limited to 'src/backend/executor/nodeGather.c')
| -rw-r--r-- | src/backend/executor/nodeGather.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/backend/executor/nodeGather.c b/src/backend/executor/nodeGather.c index b6e82d1664f..f8c1ba637d3 100644 --- a/src/backend/executor/nodeGather.c +++ b/src/backend/executor/nodeGather.c @@ -190,7 +190,7 @@ ExecGather(GatherState *node) /* No workers? Then never mind. */ if (!got_any_worker) - ExecShutdownGather(node); + ExecShutdownGatherWorkers(node); } /* Run plan locally if no workers or not single-copy. */ @@ -402,6 +402,8 @@ ExecShutdownGatherWorkers(GatherState *node) for (i = 0; i < node->nreaders; ++i) DestroyTupleQueueReader(node->reader[i]); + + pfree(node->reader); node->reader = NULL; } |
