[Python-checkins] cpython (2.7): Fixed possible reference leaks in the _json module.

serhiy.storchaka python-checkins at python.org
Tue Jan 3 04:20:39 EST 2017


https://hg.python.org/cpython/rev/5988caffbff9
changeset:   105988:5988caffbff9
branch:      2.7
parent:      105952:74eb71b91112
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Tue Jan 03 11:17:53 2017 +0200
summary:
  Fixed possible reference leaks in the _json module.

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


diff --git a/Modules/_json.c b/Modules/_json.c
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -2077,8 +2077,11 @@
             return -1;
         }
 
-        if (Py_EnterRecursiveCall(" while encoding a JSON object"))
+        if (Py_EnterRecursiveCall(" while encoding a JSON object")) {
+            Py_DECREF(newobj);
+            Py_XDECREF(ident);
             return -1;
+        }
         rv = encoder_listencode_obj(s, rval, newobj, indent_level);
         Py_LeaveRecursiveCall();
 

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


More information about the Python-checkins mailing list