Re: missing PG_FREE_IF_COPY in textlike() and textnlike() ? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: missing PG_FREE_IF_COPY in textlike() and textnlike() ?
Date
Msg-id 3588946.1663311801@sss.pgh.pa.us
Whole thread Raw
In response to missing PG_FREE_IF_COPY in textlike() and textnlike() ?  (CK Tan <cktan@vitessedata.com>)
Responses Re: missing PG_FREE_IF_COPY in textlike() and textnlike() ?
List pgsql-hackers
CK Tan <cktan@vitessedata.com> writes:
> I see in the texteq() function calls to DatumGetTextPP() are followed
> by conditional calls to PG_FREE_IF_COPY. e.g.

That's because texteq() is potentially usable as a btree index
function, and btree isn't too forgiving about leaks.

> However, in textlike(), PG_FREE_IF_COPY calls are missing.
> https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/like.c#L283

textlike() isn't a member of any btree opclass.

> Is this a memory leak bug?

Not unless you can demonstrate a case where it causes problems.
For the most part, such functions run in short-lived contexts.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: A question about wording in messages
Next
From: Zhang Mingli
Date:
Subject: Re: Remove dead macro exec_subplan_get_plan