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

Barry Warsaw python-dev@python.org
Thu, 17 Aug 2000 22:09:52 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory slayer.i.sourceforge.net:/tmp/cvs-serv3219

Modified Files:
	_sre.c 
Log Message:
pattern_findall(): Plug small memory leak discovered by Insure.
PyList_Append() always incref's the inserted item.  Be sure to decref
it regardless of whether the append succeeds or fails.


Index: _sre.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_sre.c,v
retrieving revision 2.37
retrieving revision 2.38
diff -C2 -r2.37 -r2.38
*** _sre.c	2000/08/16 22:29:55	2.37
--- _sre.c	2000/08/18 05:09:50	2.38
***************
*** 1699,1706 ****
              }
  
!             if (PyList_Append(list, item) < 0) {
!                 Py_DECREF(item);
                  goto error;
-             }
  
              if (state.ptr == state.start)
--- 1699,1706 ----
              }
  
! 	    status = PyList_Append(list, item);
! 	    Py_DECREF(item);
!             if (status < 0)
                  goto error;
  
              if (state.ptr == state.start)