Fixed reference leak when read truncated pickle.

This commit is contained in:
Serhiy Storchaka 2015-12-01 00:32:49 +02:00
parent 2329eeda0c
commit 048e107859
1 changed files with 4 additions and 1 deletions

View File

@ -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);