diff Parser/parser.c @ 37557:6ae4adefc573 legacy-trunk

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.
author Neal Norwitz <nnorwitz@gmail.com>
date Mon, 10 Apr 2006 06:42:25 +0000
parents 57322cb2ca11
children 292854c43b99
line wrap: on
line diff
--- a/Parser/parser.c	Mon Apr 10 02:17:47 2006 +0000
+++ b/Parser/parser.c	Mon Apr 10 06:42:25 2006 +0000
@@ -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);
 }