Skip to content

Commit

Permalink
fix single tuple result memory leak (#6724)
Browse files Browse the repository at this point in the history
We should not omit to free PGResult when we receive single tuple result
from an internal backend.
Single tuple results are normally freed by our ReceiveResults for
`tupleDescriptor != NULL` flow but not for those with `tupleDescriptor
== NULL`. See PR #6722 for details.

DESCRIPTION: Fixes memory leak issue with query results that returns
single row.

(cherry picked from commit 9e69dd0)
  • Loading branch information
aykut-bozkurt committed Feb 17, 2023
1 parent 8b4bab1 commit 758cda1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/backend/distributed/executor/adaptive_executor.c
Original file line number Diff line number Diff line change
Expand Up @@ -3930,6 +3930,7 @@ ReceiveResults(WorkerSession *session, bool storeRows)
TupleDesc tupleDescriptor = tupleDest->tupleDescForQuery(tupleDest, queryIndex);
if (tupleDescriptor == NULL)
{
PQclear(result);
continue;
}

Expand Down

0 comments on commit 758cda1

Please sign in to comment.