Re: [PATCH] Make gram.y use palloc/pfree for memory management

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Marko Kreen" <markokr(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] Make gram.y use palloc/pfree for memory management
Date: 2008-09-02 20:43:13
Message-ID: 5621.1220388193@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Marko Kreen" <markokr(at)gmail(dot)com> writes:
> On 9/1/08, Marko Kreen <markokr(at)gmail(dot)com> wrote:
>> First a correction, overriding malloc/free seems dangerous they
>> seems to leak out, so correct would be to use YYMALLOC/YYFREE.
>> This leaves 1.875 potentially leaking, but danger seems small.

> Here is the safer patch. As the chance for the leak is rare,
> leaving 1.875 vulnerable should not be problem.

Actually, 1.875 appears to default to using alloca() when available,
so the issue doesn't even arise if you're building with gcc. (This
is probably why I'd never noticed a problem in this area.)

I thought that we might have an issue with flex as well, but so far as
I can tell there's no real problem given our current usage style for
the lexers.

Applied to all the backend .l files ...

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-09-02 21:03:59 Re: make dist does not include man.tar.gz and postgres.tar.gz
Previous Message Alvaro Herrera 2008-09-02 20:24:15 make dist does not include man.tar.gz and postgres.tar.gz