Re: pgsql: Remove unnecessary casts in free() and pfree()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: Re: pgsql: Remove unnecessary casts in free() and pfree()
Date: 2022-08-27 14:49:39
Message-ID: 2342337.1661611779@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

I wrote:
> Justin Pryzby <pryzby(at)telsasoft(dot)com> writes:
>> This seems to be breaking cfbot's "warnings" test.

> Hmm, well, casting away const is certainly not within pfree's remit,
> so I'm glad we changed this.

Oh, I see: sepgsql's quote_object_name() is doing

const char *temp;

temp = quote_identifier(src1);
appendStringInfoString(&result, temp);
if (src1 != temp)
pfree(temp);

evidently because whoever wrote this felt a compulsion to override
quote_identifier's judgment that possibly leaking the quoted identifier
wasn't worth worrying about. I think we should just nuke this code
altogether and write

appendStringInfoString(&result, quote_identifier(src1));

regards, tom lane

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2022-08-27 16:11:41 pgsql: Repair rare failure of MULTIEXPR_SUBLINK subplans in inherited u
Previous Message Tom Lane 2022-08-27 14:15:17 Re: pgsql: Remove unnecessary casts in free() and pfree()