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.