pgoutput: Fix memory leak due to RelationSyncEntry.map.
authorAmit Kapila <akapila@postgresql.org>
Tue, 1 Jun 2021 08:44:02 +0000 (14:14 +0530)
committerAmit Kapila <akapila@postgresql.org>
Tue, 1 Jun 2021 08:57:14 +0000 (14:27 +0530)
commiteb89cb43a0d0e401e71b8e2345b5f5bc8b2755a1
treee92c866c1bb9152c3b446a3fddae952c0553e95c
parenta40646e30d85e51a76fb620822d4d921b6802157
pgoutput: Fix memory leak due to RelationSyncEntry.map.

Release memory allocated when creating the tuple-conversion map and its
component TupleDescs when its owning sync entry is invalidated.
TupleDescs must also be freed when no map is deemed necessary, to begin
with.

Reported-by: Andres Freund
Author: Amit Langote
Reviewed-by: Takamichi Osumi, Amit Kapila
Backpatch-through: 13, where it was introduced
Discussion: https://postgr.es/m/MEYP282MB166933B1AB02B4FE56E82453B64D9@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM
src/backend/replication/pgoutput/pgoutput.c
src/test/subscription/t/013_partition.pl