From 805a2ac602f91d4190eeed4650f00e083abd4082 Mon Sep 17 00:00:00 2001 From: Hadi Moshayedi Date: Tue, 2 Jul 2019 10:12:13 -0700 Subject: [PATCH] Fix a use after free in adaptive executor --- src/backend/distributed/executor/adaptive_executor.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/backend/distributed/executor/adaptive_executor.c b/src/backend/distributed/executor/adaptive_executor.c index c529bbe03..8c0567561 100644 --- a/src/backend/distributed/executor/adaptive_executor.c +++ b/src/backend/distributed/executor/adaptive_executor.c @@ -1171,16 +1171,15 @@ CleanUpSessions(DistributedExecution *execution) elog(WARNING, "unexpected transaction state at the end of execution: %d", transactionState); } + + /* get ready for the next executions if we need use the same connection */ + connection->waitFlags = WL_SOCKET_READABLE | WL_SOCKET_WRITEABLE; } else { elog(WARNING, "unexpected connection state at the end of execution: %d", connection->connectionState); } - - /* get ready for the next executions if we need use the same connection */ - connection->waitFlags = WL_SOCKET_READABLE | WL_SOCKET_WRITEABLE; - execution->waitFlagsChanged = true; } }