Re: [PATCH] Make gram.y use palloc/pfree for memory management - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCH] Make gram.y use palloc/pfree for memory management
Date
Msg-id 5621.1220388193@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCH] Make gram.y use palloc/pfree for memory management  ("Marko Kreen" <markokr@gmail.com>)
List pgsql-hackers
"Marko Kreen" <markokr@gmail.com> writes:
> On 9/1/08, Marko Kreen <markokr@gmail.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


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: make dist does not include man.tar.gz and postgres.tar.gz
Next
From: Tom Lane
Date:
Subject: Re: make dist does not include man.tar.gz and postgres.tar.gz