From 208ed37da054e7ffc82180bcca01134ac7ea7786 Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Sun, 16 May 2021 11:22:59 -0500
Subject: [PATCH 5/5] create_range_bounds: pfree() intermediate results

---
 src/backend/partitioning/partbounds.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/backend/partitioning/partbounds.c b/src/backend/partitioning/partbounds.c
index 961447ba5d..e3b2256693 100644
--- a/src/backend/partitioning/partbounds.c
+++ b/src/backend/partitioning/partbounds.c
@@ -715,6 +715,8 @@ create_range_bounds(PartitionBoundSpec **boundspecs, int nparts,
 		prev = cur;
 	}
 
+	pfree(all_bounds);
+
 	/* Update ndatums to hold the count of distinct datums. */
 	ndatums = k;
 
@@ -781,6 +783,8 @@ create_range_bounds(PartitionBoundSpec **boundspecs, int nparts,
 		}
 	}
 
+	pfree(rbounds);
+
 	/* Set the canonical value for default_index, if any. */
 	if (default_index != -1)
 	{
-- 
2.17.0

