[Python-checkins] cpython (merge 3.4 -> default): Fixed memory leak in marshal.

serhiy.storchaka python-checkins at python.org
Wed Jan 28 16:12:21 CET 2015


https://hg.python.org/cpython/rev/a0b2b5abf88c
changeset:   94352:a0b2b5abf88c
parent:      94350:eb26255e11f1
parent:      94351:8dfbaa2e8d26
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Wed Jan 28 17:11:12 2015 +0200
summary:
  Fixed memory leak in marshal.

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


diff --git a/Python/marshal.c b/Python/marshal.c
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -1520,8 +1520,10 @@
     wf.depth = 0;
     wf.version = version;
     if (version >= 3) {
-        if ((wf.refs = PyDict_New()) == NULL)
+        if ((wf.refs = PyDict_New()) == NULL) {
+            Py_DECREF(wf.str);
             return NULL;
+        }
     } else
         wf.refs = NULL;
     w_object(x, &wf);

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


More information about the Python-checkins mailing list