[Python-checkins] python/dist/src/Objects listobject.c,2.103.6.5,2.103.6.6

loewis@users.sourceforge.net loewis@users.sourceforge.net
Sat, 03 May 2003 03:53:53 -0700


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

Modified Files:
      Tag: release22-maint
	listobject.c 
Log Message:
Patch #708604: Check more function results.


Index: listobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/listobject.c,v
retrieving revision 2.103.6.5
retrieving revision 2.103.6.6
diff -C2 -d -r2.103.6.5 -r2.103.6.6
*** listobject.c	29 Dec 2002 05:59:09 -0000	2.103.6.5
--- listobject.c	3 May 2003 10:53:51 -0000	2.103.6.6
***************
*** 469,472 ****
--- 469,474 ----
  			int ret;
  			v = list_slice(b, 0, n);
+ 			if (v == NULL)
+ 				return -1;
  			ret = list_ass_slice(a, ilow, ihigh, v);
  			Py_DECREF(v);
***************
*** 490,495 ****
  	item = a->ob_item;
  	d = n - (ihigh-ilow);
! 	if (ihigh > ilow)
  		p = recycle = PyMem_NEW(PyObject *, (ihigh-ilow));
  	else
  		p = recycle = NULL;
--- 492,502 ----
  	item = a->ob_item;
  	d = n - (ihigh-ilow);
! 	if (ihigh > ilow) {
  		p = recycle = PyMem_NEW(PyObject *, (ihigh-ilow));
+ 		if (recycle == NULL) {
+ 			PyErr_NoMemory();
+ 			return -1;
+ 		}
+ 	}
  	else
  		p = recycle = NULL;