missing PG_FREE_IF_COPY in textlike() and textnlike() ?

From: CK Tan <cktan(at)vitessedata(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: missing PG_FREE_IF_COPY in textlike() and textnlike() ?
Date: 2022-09-16 06:56:43
Message-ID: CAJNt7=ZeciAZAgH03MSTPwo2cD5ROSnpo9+xwoA7SrPYMpjJ9A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Hackers,

I see in the texteq() function calls to DatumGetTextPP() are followed
by conditional calls to PG_FREE_IF_COPY. e.g.

https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/varlena.c#L1792

text *targ1 = DatumGetTextPP(arg1);
text *targ2 = DatumGetTextPP(arg2);
result = (memcmp(VARDATA_ANY(targ1), VARDATA_ANY(targ2), len1 -
VARHDRSZ) == 0);
PG_FREE_IF_COPY(targ1, 0);
PG_FREE_IF_COPY(targ2, 1);

However, in textlike(), PG_FREE_IF_COPY calls are missing.

https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/like.c#L283

Is this a memory leak bug?

Regards,
-cktan

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2022-09-16 06:59:52 Re: A question about wording in messages
Previous Message bt22nakamorit 2022-09-16 06:55:33 Make ON_ERROR_STOP stop on shell script failure