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

From Marko Kreen
Subject [PATCH] Make gram.y use palloc/pfree for memory management
Date
Msg-id 20080831221727.18573.11996.stgit@lapp
Whole thread Raw
Responses Re: [PATCH] Make gram.y use palloc/pfree for memory management  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Currently gram.y uses malloc/free for memory management,
but all pointers are local to function.  Unlike flex-based
scan.l which has static references to buffers and reuses them
across calls.

This means gram.y can leak memory if error is throws in
the middle of parsing.

The patch redefines malloc/free to palloc/pfree to fix the leak.

I did not use YYSTACK_ALLOC / YYSTACK_FREE that exists in newer bison,
because bison 1.875 does not support those.
Attachment

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: WIP patch: Collation support
Next
From: Marko Kreen
Date:
Subject: [PATCH] Cleanup of GUC units code