[Python-checkins] python/dist/src/Modules cPickle.c,2.96,2.97

tim_one@users.sourceforge.net tim_one@users.sourceforge.net
2002年12月06日 18:43:31 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv25859/python/Modules
Modified Files:
	cPickle.c 
Log Message:
A patch from Kevin Jacobs, plugging several leaks discovered when
running the sandbox datetime tests.
Bugfix candidate.
Index: cPickle.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/cPickle.c,v
retrieving revision 2.96
retrieving revision 2.97
diff -C2 -d -r2.96 -r2.97
*** cPickle.c	16 Sep 2002 17:26:23 -0000	2.96
--- cPickle.c	7 Dec 2002 02:43:28 -0000	2.97
***************
*** 226,233 ****
 }
 
- #define PDATA_APPEND_(D,O,ER) { \
- if (Pdata_Append(((Pdata*)(D)), O) < 0) return ER; \
- }
- 
 #define PDATA_APPEND(D,O,ER) { \
 if (((Pdata*)(D))->length == ((Pdata*)(D))->size && \
--- 226,229 ----
***************
*** 898,901 ****
--- 894,898 ----
 			return 0;
 		if (PyDict_GetItem(self->fast_memo, key)) {
+ 			Py_DECREF(key);
 			PyErr_Format(PyExc_ValueError,
 				 "fast mode: can't pickle cyclic objects including object type %s at %p",
***************
*** 905,911 ****
--- 902,910 ----
 		}
 		if (PyDict_SetItem(self->fast_memo, key, Py_None) < 0) {
+ 			Py_DECREF(key);
 			self->fast_container = -1;
 			return 0;
 		}
+ 		Py_DECREF(key);
 	}
 	return 1;
***************
*** 920,925 ****
--- 919,926 ----
 			return 0;
 		if (PyDict_DelItem(self->fast_memo, key) < 0) {
+ 			Py_DECREF(key);
 			return 0;
 		}
+ 		Py_DECREF(key);
 	}
 	return 1;
***************
*** 3116,3119 ****
--- 3117,3121 ----
 			return NULL;
 		}
+ 		Py_DECREF(safe);
 	}
 
***************
*** 3219,3223 ****
 
 	if ((len = (*self->readline_func)(self, &s)) >= 0) {
! 		if (len < 2) return bad_readline();
 		if ((class_name = PyString_FromStringAndSize(s, len - 1))) {
 			class = find_class(module_name, class_name, 
--- 3221,3228 ----
 
 	if ((len = (*self->readline_func)(self, &s)) >= 0) {
! 		if (len < 2) {
! 			Py_DECREF(module_name);
! 			return bad_readline();
! 		}
 		if ((class_name = PyString_FromStringAndSize(s, len - 1))) {
 			class = find_class(module_name, class_name, 

AltStyle によって変換されたページ (->オリジナル) /