]> granicus.if.org Git - python/commitdiff
Fixed reference leak when read truncated pickle.
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 30 Nov 2015 22:18:23 +0000 (00:18 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Mon, 30 Nov 2015 22:18:23 +0000 (00:18 +0200)
Modules/_pickle.c

index 6ff16bba7dfc4e2ce88950c6aaf1e2eb90d0da8e..c357dcc219473a3610da1d9cc9bad76ea71e8032 100644 (file)
@@ -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);