From 4f7b6dfa3b384d3aa870da8b37f500aa68e9451d Mon Sep 17 00:00:00 2001
From: Amit Kapila <akapila@postgresql.org>
Date: Wed, 23 Mar 2022 08:51:05 +0530
Subject: [PATCH v2] Remove some useless free calls.

These were introduced in recent commit 52e4f0cd47. We were trying to free
some transient space consumption and that too was not entirely correct and
complete. We don't need this partial freeing of memory as it will be
allocated just once for a query and will be freed at the end of the query.

Author: Zhihong Yu
Reviewed-by: Amit Kapila
Discussion: https://postgr.es/m/CALNJ-vQORfQ=vicbKA_RmeGZGzm1y3WsEcZqXWi7qjN43Cz_vg@mail.gmail.com
---
 src/backend/commands/publicationcmds.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index 1aad2e7..9937adb 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -358,9 +358,6 @@ contain_invalid_rfcolumn(Oid pubid, Relation relation, List *ancestors,
 		context.bms_replident = bms;
 		rfnode = stringToNode(TextDatumGetCString(rfdatum));
 		result = contain_invalid_rfcolumn_walker(rfnode, &context);
-
-		bms_free(bms);
-		pfree(rfnode);
 	}
 
 	ReleaseSysCache(rftuple);
@@ -1046,9 +1043,6 @@ AlterPublicationTables(AlterPublicationStmt *stmt, HeapTuple tup,
 				}
 			}
 
-			if (oldrelwhereclause)
-				pfree(oldrelwhereclause);
-
 			/*
 			 * Add the non-matched relations to a list so that they can be
 			 * dropped.
-- 
1.8.3.1

