Commit 5f95257e authored by Amaury Forgeot d'Arc's avatar Amaury Forgeot d'Arc

#4373: Reference leak in the pickle module.

Reviewed by Brett Cannon.
parent 7317c1ef
...@@ -22,6 +22,8 @@ Core and Builtins ...@@ -22,6 +22,8 @@ Core and Builtins
Library 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 - Issue #4382: dbm.dumb did not specify the expected file encoding for opened
files. files.
......
...@@ -486,11 +486,13 @@ unpickler_read(UnpicklerObject *self, char **s, Py_ssize_t n) ...@@ -486,11 +486,13 @@ unpickler_read(UnpicklerObject *self, char **s, Py_ssize_t n)
PyErr_SetString(PyExc_ValueError, PyErr_SetString(PyExc_ValueError,
"read() from the underlying stream did not" "read() from the underlying stream did not"
"return bytes"); "return bytes");
Py_DECREF(data);
return -1; return -1;
} }
if (PyBytes_GET_SIZE(data) != n) { if (PyBytes_GET_SIZE(data) != n) {
PyErr_SetNone(PyExc_EOFError); PyErr_SetNone(PyExc_EOFError);
Py_DECREF(data);
return -1; return -1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment