From: Alvaro Herrera Date: Mon, 23 Apr 2018 14:50:21 +0000 (-0300) Subject: Add missing pstrdup X-Git-Tag: REL_11_BETA1~187 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bc972072a3bb77e51a7937b05d25b41ba96aa011;p=postgresql Add missing pstrdup Lifetime of the input string is not right, so create a separate copy. Author: Amit Langote Discussion: https://postgr.es/m/a2773420-50d1-0a42-3396-fe42b0921134@lab.ntt.co.jp --- diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index c1a9bda433..2c23371a19 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -14568,7 +14568,8 @@ CloneRowTriggersToPartition(Relation parent, Relation partition) col = TupleDescAttr(parent->rd_att, trigForm->tgattr.values[i] - 1); - cols = lappend(cols, makeString(NameStr(col->attname))); + cols = lappend(cols, + makeString(pstrdup(NameStr(col->attname)))); } }