Avoid resource leak (contrib/postgres_fdw/connection.c)

From: Ranier Vilela <ranier(dot)vf(at)gmail(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Avoid resource leak (contrib/postgres_fdw/connection.c)
Date: 2026-03-16 11:45:49
Message-ID: CAEudQAprLegxufoi93JuFVkCDmjT5wtGhu3gxT-E1Fg+1DGrag@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi.

Per Coverity.

CID 1645716: (#1 of 1): Resource leak (RESOURCE_LEAK)
8. leaked_storage: Variable str going out of scope leaks the storage
str.data points to.

The function *postgres_fdw_connection* leaks the contents of
var str.data
Once that function *cstring_to_text* palloc the contents
must be necessary to free the var str.data.

patch attached.

best regards,
Ranier Vilelas

Attachment Content-Type Size
avoid-resource-leak-postgres_fdw-connection.patch application/octet-stream 827 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2026-03-16 11:54:41 Re: Report bytes and transactions actually sent downtream
Previous Message shveta malik 2026-03-16 11:27:32 Re: synchronized_standby_slots behavior inconsistent with quorum-based synchronous replication