Patch from Vladimir Marangozov <marangoz@python.inrialpes.fr>
authorAndrew M. Kuchling <amk@amk.ca>
Fri, 18 Feb 2000 19:16:45 +0000 (19:16 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Fri, 18 Feb 2000 19:16:45 +0000 (19:16 +0000)
The same problem (mixed mallocs) exists for the pcre stack.
The buffers md->... are allocated via PyMem_RESIZE in grow_stack(),
while in free_stack() they are released with free() instead of
PyMem_DEL().

Modules/pypcre.c

index 976eb21fc328cb1a4c6b465609db449ebc8bf921..468751d2c81e2f3c43ac8249aaa6a8a255fef44e 100644 (file)
@@ -3057,12 +3057,12 @@ return TRUE;
 static int free_stack(match_data *md)
 {
 /* Free any stack space that was allocated by the call to match(). */
-if (md->off_num)    free(md->off_num); 
-if (md->offset_top) free(md->offset_top); 
-if (md->r1)         free(md->r1); 
-if (md->r2)         free(md->r2); 
-if (md->eptr)       free((char *)md->eptr); 
-if (md->ecode)      free((char *)md->ecode);
+if (md->off_num)    PyMem_DEL(md->off_num); 
+if (md->offset_top) PyMem_DEL(md->offset_top); 
+if (md->r1)         PyMem_DEL(md->r1); 
+if (md->r2)         PyMem_DEL(md->r2); 
+if (md->eptr)       PyMem_DEL((char *)md->eptr); 
+if (md->ecode)      PyMem_DEL((char *)md->ecode);
 return 0;
 }