Add missing pstrdup
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Mon, 23 Apr 2018 14:50:21 +0000 (11:50 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Mon, 23 Apr 2018 15:11:41 +0000 (12:11 -0300)
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

src/backend/commands/tablecmds.c

index c1a9bda4331fbbd17a46d0d6f6ed6c16ad4a629c..2c23371a194deb8ac81d837d70b89ff8cfa61588 100644 (file)
@@ -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))));
            }
        }