[Python-checkins] CVS: python/dist/src/Objects unicodeobject.c,2.58,2.59

Barry Warsaw python-dev@python.org
Thu, 17 Aug 2000 23:58:18 -0700


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

Modified Files:
	unicodeobject.c 
Log Message:
PyUnicode_AsUTF8String(): Don't need to explicitly incref str since
PyUnicode_EncodeUTF8() already returns the created object with the
proper reference count.  This fixes an Insure reported memory leak.


Index: unicodeobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/unicodeobject.c,v
retrieving revision 2.58
retrieving revision 2.59
diff -C2 -r2.58 -r2.59
*** unicodeobject.c	2000/08/14 11:29:19	2.58
--- unicodeobject.c	2000/08/18 06:58:15	2.59
***************
*** 908,918 ****
          return NULL;
      }
!     str = PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(unicode),
! 			       PyUnicode_GET_SIZE(unicode),
! 			       NULL);
!     if (str == NULL)
!         return NULL;
!     Py_INCREF(str);
!     return str;
  }
  
--- 908,914 ----
          return NULL;
      }
!     return PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(unicode),
! 				PyUnicode_GET_SIZE(unicode),
! 				NULL);
  }