From 5f95257ef9a4ec72963b6bb5f6b056a52d5c010f Mon Sep 17 00:00:00 2001 From: Amaury Forgeot d'Arc Date: Tue, 25 Nov 2008 21:11:54 +0000 Subject: [PATCH] #4373: Reference leak in the pickle module. Reviewed by Brett Cannon. --- Misc/NEWS | 2 ++ Modules/_pickle.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Misc/NEWS b/Misc/NEWS index bc127e70a1..50a3331564 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -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. diff --git a/Modules/_pickle.c b/Modules/_pickle.c index c1facd8381..a0810b99a9 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -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; } -- 2.40.0