From 048e1078599b3fca9555e57897507372eddf8b37 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Tue, 1 Dec 2015 00:32:49 +0200 Subject: Fixed reference leak when read truncated pickle. --- Modules/cPickle.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Modules/cPickle.c b/Modules/cPickle.c index e195961..ce9283a 100644 --- a/Modules/cPickle.c +++ b/Modules/cPickle.c @@ -3969,7 +3969,10 @@ load_inst(Unpicklerobject *self) if (!module_name) return -1; if ((len = self->readline_func(self, &s)) >= 0) { - if (len < 2) return bad_readline(); + 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, self->find_class); -- cgit v0.12