[Python-checkins] python/dist/src/Objects intobject.c,2.79.6.5,2.79.6.6

nnorwitz@users.sourceforge.net nnorwitz@users.sourceforge.net
Sun, 19 Jan 2003 07:48:40 -0800


Update of /cvsroot/python/python/dist/src/Objects
In directory sc8-pr-cvs1:/tmp/cvs-serv31004/Objects

Modified Files:
      Tag: release22-maint
	intobject.c 
Log Message:
Backport SF # 669553, fix memory (ref) leaks


Index: intobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v
retrieving revision 2.79.6.5
retrieving revision 2.79.6.6
diff -C2 -d -r2.79.6.5 -r2.79.6.6
*** intobject.c	23 Sep 2002 21:02:33 -0000	2.79.6.5
--- intobject.c	19 Jan 2003 15:48:38 -0000	2.79.6.6
***************
*** 650,656 ****
  	x = -a;
  	if (a < 0 && x < 0) {
  		if (err_ovf("integer negation"))
  			return NULL;
! 		return PyNumber_Negative(PyLong_FromLong(a));
  	}
  	return PyInt_FromLong(x);
--- 650,663 ----
  	x = -a;
  	if (a < 0 && x < 0) {
+ 		PyObject *o;
  		if (err_ovf("integer negation"))
  			return NULL;
! 		o = PyLong_FromLong(a);
! 		if (o != NULL) {
! 			PyObject *result = PyNumber_Negative(o);
! 			Py_DECREF(o);
! 			return result;
! 		}
! 		return NULL;
  	}
  	return PyInt_FromLong(x);