summaryrefslogtreecommitdiffstats
path: root/Modules/pypcre.c
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2000-02-18 19:16:45 (GMT)
committerAndrew M. Kuchling <amk@amk.ca>2000-02-18 19:16:45 (GMT)
commitfc9d2252afcdb43a26cab90969f6c42bd97c277c (patch)
tree6c05288b30ab9113ab50f1df50baafb0df78f8d0 /Modules/pypcre.c
parent0c7822e8325420d9f76c6f38d2d7a1b1a4291a76 (diff)
downloadcpython-fc9d2252afcdb43a26cab90969f6c42bd97c277c.zip
cpython-fc9d2252afcdb43a26cab90969f6c42bd97c277c.tar.gz
cpython-fc9d2252afcdb43a26cab90969f6c42bd97c277c.tar.bz2
Patch from Vladimir Marangozov <marangoz@python.inrialpes.fr>
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().
Diffstat (limited to 'Modules/pypcre.c')
-rw-r--r--Modules/pypcre.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Modules/pypcre.c b/Modules/pypcre.c
index 976eb21..468751d 100644
--- a/Modules/pypcre.c
+++ b/Modules/pypcre.c
@@ -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;
}