]> granicus.if.org Git - python/commitdiff
Fixed possible reference leaks in the _json module.
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 3 Jan 2017 09:17:53 +0000 (11:17 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Tue, 3 Jan 2017 09:17:53 +0000 (11:17 +0200)
Modules/_json.c

index 189cb2cb3007eb9fceae1b9cfc448efcb89d969d..7860e9a6eca4cd1eb1841db17d426732fe053cca 100644 (file)
@@ -2077,8 +2077,11 @@ encoder_listencode_obj(PyEncoderObject *s, PyObject *rval, PyObject *obj, Py_ssi
             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();