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.
This commit is contained in:
Neal Norwitz 2006-04-10 06:42:25 +00:00
parent 65c05b20e9
commit 2c4e4f9839
9 changed files with 45 additions and 37 deletions

View file

@ -75,7 +75,7 @@ PyParser_New(grammar *g, int start)
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 @@ PyParser_New(grammar *g, int start)
#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 @@ PyParser_Delete(parser_state *ps)
/* 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);
}