Re: Report a potential bug caused by a improper call to pfree() - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Report a potential bug caused by a improper call to pfree()
Date
Msg-id 216147.1643556567@sss.pgh.pa.us
Whole thread Raw
In response to Re: Report a potential bug caused by a improper call to pfree()  (Julien Rouhaud <rjuju123@gmail.com>)
Responses Re: Report a potential bug caused by a improper call to pfree()  (Kyotaro Horiguchi <horikyota.ntt@gmail.com>)
List pgsql-bugs
Julien Rouhaud <rjuju123@gmail.com> writes:
> On Sun, Jan 30, 2022 at 10:47:18AM +0800, wliang@stu.xidian.edu.cn wrote:
>> 1160                 /* Pop the stack */
>> 1161                 parent = stack->parent;
>> 1162                 pfree(stack);
>>
>> I think it may be a potential bug and can be fixed without any side-effect as:
>>
>>
>> ++        if (stack != &tail)
>> 1162                pfree(stack);

> I don't think it's necessary, it should be guaranteed that something as been
> pushed on the tail, ie. there shouldn't be a WJB_END_* before a corresponding
> begin.

I've not checked the logic, but the lack of any reported crashes here
seems to confirm that there's no bug.

            regards, tom lane



pgsql-bugs by date:

Previous
From: Julien Rouhaud
Date:
Subject: Re: Report a potential bug caused by a improper call to pfree()
Next
From: "Ian R. Campbell"
Date:
Subject: Missing include in float.h