From: Serhiy Storchaka Date: Mon, 30 Nov 2015 22:18:23 +0000 (+0200) Subject: Fixed reference leak when read truncated pickle. X-Git-Tag: v3.4.4rc1~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ca28eba3d3656bab394f846f9357227d227059ec;p=python Fixed reference leak when read truncated pickle. --- diff --git a/Modules/_pickle.c b/Modules/_pickle.c index 6ff16bba7d..c357dcc219 100644 --- a/Modules/_pickle.c +++ b/Modules/_pickle.c @@ -5115,8 +5115,10 @@ load_inst(UnpicklerObject *self) return -1; if ((len = _Unpickler_Readline(self, &s)) >= 0) { - if (len < 2) + if (len < 2) { + Py_DECREF(module_name); return bad_readline(); + } class_name = PyUnicode_DecodeASCII(s, len - 1, "strict"); if (class_name != NULL) { cls = find_class(self, module_name, class_name);