Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fc9d225

Browse files
committed
Patch from Vladimir Marangozov <[email protected]>
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().
1 parent 0c7822e commit fc9d225

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Modules/pypcre.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3057,12 +3057,12 @@ return TRUE;
30573057
static int free_stack(match_data *md)
30583058
{
30593059
/* Free any stack space that was allocated by the call to match(). */
3060-
if (md->off_num) free(md->off_num);
3061-
if (md->offset_top) free(md->offset_top);
3062-
if (md->r1) free(md->r1);
3063-
if (md->r2) free(md->r2);
3064-
if (md->eptr) free((char *)md->eptr);
3065-
if (md->ecode) free((char *)md->ecode);
3060+
if (md->off_num) PyMem_DEL(md->off_num);
3061+
if (md->offset_top) PyMem_DEL(md->offset_top);
3062+
if (md->r1) PyMem_DEL(md->r1);
3063+
if (md->r2) PyMem_DEL(md->r2);
3064+
if (md->eptr) PyMem_DEL((char *)md->eptr);
3065+
if (md->ecode) PyMem_DEL((char *)md->ecode);
30663066
return 0;
30673067
}
30683068

0 commit comments

Comments
 (0)