[Python-checkins] CVS: python/dist/src/Modules _sre.c,2.74,2.75

Guido van Rossum gvanrossum@users.sourceforge.net
2001年12月06日 20:25:12 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv2077
Modified Files:
	_sre.c 
Log Message:
Fix for #489672 (Neil Norwitz): memory leak in test_sre.
(At least for the repeatable test case that Tim produced.)
pattern_subx(): Add missing DECREF(filter) in both exit branches
(normal and error return). Also fix a DECREF(args) that should
certainly be a DECREF(match) -- because it's inside if (!args) and
right after allocation of match.
Index: _sre.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v
retrieving revision 2.74
retrieving revision 2.75
diff -C2 -d -r2.74 -r2.75
*** _sre.c	2001年10月24日 22:16:30	2.74
--- _sre.c	2001年12月07日 04:25:10	2.75
***************
*** 2200,2204 ****
 args = Py_BuildValue("(O)", match);
 if (!args) {
! Py_DECREF(args);
 goto error;
 }
--- 2200,2204 ----
 args = Py_BuildValue("(O)", match);
 if (!args) {
! Py_DECREF(match);
 goto error;
 }
***************
*** 2247,2250 ****
--- 2247,2252 ----
 state_fini(&state);
 
+ Py_DECREF(filter);
+ 
 /* convert list to single string (also removes list) */
 item = join(list, self->pattern);
***************
*** 2259,2262 ****
--- 2261,2265 ----
 
 error:
+ Py_DECREF(filter);
 Py_DECREF(list);
 state_fini(&state);

AltStyle によって変換されたページ (->オリジナル) /