public inbox for [email protected]
help / color / mirror / Atom feedFrom: Ranier Vilela <[email protected]>
To: Matheus Alcantara <[email protected]>
Cc: Pg Hackers <[email protected]>
Subject: Re: Avoid resource leak (contrib/postgres_fdw/connection.c)
Date: Mon, 16 Mar 2026 11:18:54 -0300
Message-ID: <CAEudQAoBPKbb3XX1H8SV95BOyJYL5SjH2D7CHKgDFBXWeSg9Lg@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CAEudQAprLegxufoi93JuFVkCDmjT5wtGhu3gxT-E1Fg+1DGrag@mail.gmail.com>
<[email protected]>
Hi.
Em seg., 16 de mar. de 2026 às 11:16, Matheus Alcantara <
[email protected]> escreveu:
> On 16/03/26 08:45, Ranier Vilela wrote:
> > 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.
> >
>
> Hi,
>
> Thanks for the patch, it looks correct to me. I've searched for this
> pattern `PG_RETURN_TEXT_P(cstring_to_text(.*.data` in other places and
> I've just found on postgres_fdw/connection.c
>
> I've also search for other cases of `return cstring_to_text(...)`
> usages and I didn't found anything that seems suspicious.
>
> Tests are also passing.
>
Thanks for taking a look.
best regards,
Ranier Vilela
view thread (5+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Avoid resource leak (contrib/postgres_fdw/connection.c)
In-Reply-To: <CAEudQAoBPKbb3XX1H8SV95BOyJYL5SjH2D7CHKgDFBXWeSg9Lg@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox