#4373: Reference leak in the pickle module.

Reviewed by Brett Cannon.
This commit is contained in:
Amaury Forgeot d'Arc 2008-11-25 21:11:54 +00:00
parent 7317c1ef7a
commit 5f95257ef9
2 changed files with 4 additions and 0 deletions

View file

@ -22,6 +22,8 @@ Core and Builtins
Library
-------
- Issue #4373: Corrected a potential reference leak in the pickle module.
- Issue #4382: dbm.dumb did not specify the expected file encoding for opened
files.

View file

@ -486,11 +486,13 @@ unpickler_read(UnpicklerObject *self, char **s, Py_ssize_t n)
PyErr_SetString(PyExc_ValueError,
"read() from the underlying stream did not"
"return bytes");
Py_DECREF(data);
return -1;
}
if (PyBytes_GET_SIZE(data) != n) {
PyErr_SetNone(PyExc_EOFError);
Py_DECREF(data);
return -1;
}