mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Issue #3660 (part of): fix a memory leak in _pickle.
Patch by Amaury Forgeot d'Arc, review by me.
This commit is contained in:
parent
9252287f2c
commit
d79dc6216c
2 changed files with 7 additions and 1 deletions
|
@ -3837,13 +3837,17 @@ load_build(UnpicklerObject *self)
|
|||
if (setstate == NULL) {
|
||||
if (PyErr_ExceptionMatches(PyExc_AttributeError))
|
||||
PyErr_Clear();
|
||||
else
|
||||
else {
|
||||
Py_DECREF(state);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
PyObject *result;
|
||||
|
||||
/* The explicit __setstate__ is responsible for everything. */
|
||||
/* Ugh... this does not leak since unpickler_call() steals the
|
||||
reference to state first. */
|
||||
result = unpickler_call(self, setstate, state);
|
||||
Py_DECREF(setstate);
|
||||
if (result == NULL)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue