summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Paquier2019-02-27 05:14:06 +0000
committerMichael Paquier2019-02-27 05:14:06 +0000
commit414a9d3cf34c7aff1c63533df4c40ebb63bd0840 (patch)
tree96ce9471675db238ad53affc5433c1ceeed7d202
parentff11e7f4b9ae017585c3ba146db7ba39c31f209a (diff)
Fix memory leak when inserting tuple at relation creation for CTAS
The leak has been introduced by 763f2ed which has addressed the problem for transient tables, and forgot CREATE TABLE AS which shares a similar logic when receiving a new tuple to store into the newly-created relation. Author: Jeff Janes Discussion: https://postgr.es/m/CAMkU=1xZXtz3mziPEPD2Fubbas4G2RWkZm5HHABtfKVcbu1=Sg@mail.gmail.com
-rw-r--r--src/backend/commands/createas.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/backend/commands/createas.c b/src/backend/commands/createas.c
index 2bc8f928ea..6517ecb738 100644
--- a/src/backend/commands/createas.c
+++ b/src/backend/commands/createas.c
@@ -587,6 +587,9 @@ intorel_receive(TupleTableSlot *slot, DestReceiver *self)
/* We know this is a newly created relation, so there are no indexes */
+ /* Free the copied tuple. */
+ heap_freetuple(tuple);
+
return true;
}