Remove unnecessary pstrdup in fetch_table_list.
authorAmit Kapila <akapila@postgresql.org>
Sat, 16 Jan 2021 04:45:32 +0000 (10:15 +0530)
committerAmit Kapila <akapila@postgresql.org>
Sat, 16 Jan 2021 04:45:32 +0000 (10:15 +0530)
The result of TextDatumGetCString is already palloc'ed so we don't need to
allocate memory for it again. We decide not to backpatch it as there
doesn't seem to be any case where it can create a meaningful leak.

Author: Zhijie Hou
Reviewed-by: Daniel Gustafsson
Discussion: https://postgr.es/m/229fed2eb8c54c71a96ccb99e516eb12@G08CNEXMBPEKD05.g08.fujitsu.local

src/backend/commands/subscriptioncmds.c

index 490e93554135e6c9e134f1f1006d7a4a01c62f6c..082f7855b89c1937eb8e44aa41efe2995c2ead51 100644 (file)
@@ -1267,7 +1267,7 @@ fetch_table_list(WalReceiverConn *wrconn, List *publications)
        relname = TextDatumGetCString(slot_getattr(slot, 2, &isnull));
        Assert(!isnull);
 
-       rv = makeRangeVar(pstrdup(nspname), pstrdup(relname), -1);
+       rv = makeRangeVar(nspname, relname, -1);
        tablelist = lappend(tablelist, rv);
 
        ExecClearTuple(slot);