SF patch #1467512, fix double free with triple quoted string in standard build.
This was the result of inconsistent use of PyMem_* and PyObject_* allocators.
By changing to use PyObject_* allocator almost everywhere, this removes
the inconsistency.
diff --git a/Parser/parser.c b/Parser/parser.c
index ada6be2..45b613a 100644
--- a/Parser/parser.c
+++ b/Parser/parser.c
@@ -75,7 +75,7 @@
if (!g->g_accel)
PyGrammar_AddAccelerators(g);
- ps = PyMem_NEW(parser_state, 1);
+ ps = PyMem_MALLOC(sizeof(parser_state));
if (ps == NULL)
return NULL;
ps->p_grammar = g;
@@ -84,7 +84,7 @@
#endif
ps->p_tree = PyNode_New(start);
if (ps->p_tree == NULL) {
- PyMem_DEL(ps);
+ PyMem_FREE(ps);
return NULL;
}
s_reset(&ps->p_stack);
@@ -98,7 +98,7 @@
/* NB If you want to save the parse tree,
you must set p_tree to NULL before calling delparser! */
PyNode_Free(ps->p_tree);
- PyMem_DEL(ps);
+ PyMem_FREE(ps);
}