[Python-checkins] CVS: python/dist/src/Modules pypcre.c,2.16,2.17
Andrew M. Kuchling
akuchlin@CNRI.Reston.VA.US
Fri, 18 Feb 2000 14:16:49 -0500 (EST)
Update of /projects/cvsroot/python/dist/src/Modules
In directory amarok:/home/akuchlin/src/Python-1.5/Modules
Modified Files:
pypcre.c
Log Message:
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().
Index: pypcre.c
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Modules/pypcre.c,v
retrieving revision 2.16
retrieving revision 2.17
diff -C2 -r2.16 -r2.17
*** pypcre.c 1999/01/27 21:41:08 2.16
--- pypcre.c 2000/02/18 19:16:45 2.17
***************
*** 3058,3067 ****
{
/* 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);
return 0;
}
--- 3058,3067 ----
{
/* Free any stack space that was allocated by the call to match(). */
! 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;
}