From 669429fb583031c7c87392e30b065e99a2d8ccda Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Wed, 12 Sep 2018 15:00:56 -0700 Subject: [PATCH] bpo-34649: Add missing NULL checks to _encoded_const() (GH-9225) Reported by Svace static analyzer. (cherry picked from commit 6f82bffd2df63a4072b3f0483cdbe93ddedb87e9) Co-authored-by: Alexey Izbyshev --- Modules/_json.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Modules/_json.c b/Modules/_json.c index 28c0b3f4570e..3a88882f0c98 100644 --- a/Modules/_json.c +++ b/Modules/_json.c @@ -1893,7 +1893,7 @@ _encoded_const(PyObject *obj) if (s_null == NULL) { s_null = PyString_InternFromString("null"); } - Py_INCREF(s_null); + Py_XINCREF(s_null); return s_null; } else if (obj == Py_True) { @@ -1901,7 +1901,7 @@ _encoded_const(PyObject *obj) if (s_true == NULL) { s_true = PyString_InternFromString("true"); } - Py_INCREF(s_true); + Py_XINCREF(s_true); return s_true; } else if (obj == Py_False) { @@ -1909,7 +1909,7 @@ _encoded_const(PyObject *obj) if (s_false == NULL) { s_false = PyString_InternFromString("false"); } - Py_INCREF(s_false); + Py_XINCREF(s_false); return s_false; } else { -- 2.47.3