[Python-checkins] cpython (3.4): Fixed reference leak when read truncated pickle.

serhiy.storchaka python-checkins at python.org
Mon Nov 30 17:21:18 EST 2015


https://hg.python.org/cpython/rev/67b341701f5e
changeset:   99396:67b341701f5e
branch:      3.4
parent:      99392:095d21df9374
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Tue Dec 01 00:18:23 2015 +0200
summary:
  Fixed reference leak when read truncated pickle.

files:
  Modules/_pickle.c |  4 +++-
  1 files changed, 3 insertions(+), 1 deletions(-)


diff --git a/Modules/_pickle.c b/Modules/_pickle.c
--- a/Modules/_pickle.c
+++ b/Modules/_pickle.c
@@ -5115,8 +5115,10 @@
         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);

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list