summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-11-30 22:32:49 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-11-30 22:32:49 (GMT)
commit048e1078599b3fca9555e57897507372eddf8b37 (patch)
treed535b1145706c9a4a914d55e2900bba38f9b7bad /Modules
parent2329eeda0cabfda89e915e9a571a229707602963 (diff)
downloadcpython-048e1078599b3fca9555e57897507372eddf8b37.zip
cpython-048e1078599b3fca9555e57897507372eddf8b37.tar.gz
cpython-048e1078599b3fca9555e57897507372eddf8b37.tar.bz2
Fixed reference leak when read truncated pickle.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/cPickle.c5
1 files changed, 4 insertions, 1 deletions
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);