On 9/1/08, Marko Kreen <[EMAIL PROTECTED]> 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.

-- 
marko
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 0af6142..62c4b63 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -62,6 +62,11 @@
 #include "utils/numeric.h"
 #include "utils/xml.h"
 
+/*
+ * bison does not re-use buffers, so we can order it to use palloc/pfree.
+ */
+#define YYMALLOC palloc
+#define YYFREE   pfree
 
 /* Location tracking support --- simpler than bison's default */
 #define YYLLOC_DEFAULT(Current, Rhs, N) \
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to