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

From: Marko Kreen <markokr(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: [PATCH] Make gram.y use palloc/pfree for memory management
Date: 2008-08-31 22:17:27
Message-ID: 20080831221727.18573.11996.stgit@lapp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
gram-memleak-fix.patch text/plain 849 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Marko Kreen 2008-08-31 22:17:33 [PATCH] Cleanup of GUC units code
Previous Message Alvaro Herrera 2008-08-31 22:08:40 Re: WIP patch: Collation support