[Python-checkins] python/dist/src/Objects intobject.c,2.98,2.99

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


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

Modified Files:
	intobject.c 
Log Message:
SF # 669553, fix memory (ref) leaks

Will backport.


Index: intobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/intobject.c,v
retrieving revision 2.98
retrieving revision 2.99
diff -C2 -d -r2.98 -r2.99
*** intobject.c	31 Dec 2002 03:42:13 -0000	2.98
--- intobject.c	19 Jan 2003 15:40:09 -0000	2.99
***************
*** 607,613 ****
  	x = -a;
  	if (a < 0 && x < 0) {
  		if (err_ovf("integer negation"))
  			return NULL;
! 		return PyNumber_Negative(PyLong_FromLong(a));
  	}
  	return PyInt_FromLong(x);
--- 607,620 ----
  	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);