From f04790a4b70bd2f9a2f74c032c3b4a4ffb1a9127 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Tue, 3 Jan 2017 11:17:53 +0200 Subject: [PATCH] Fixed possible reference leaks in the _json module. --- Modules/_json.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Modules/_json.c b/Modules/_json.c index 189cb2cb30..7860e9a6ec 100644 --- a/Modules/_json.c +++ b/Modules/_json.c @@ -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(); -- 2.50.1