diff options
| author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-09-12 14:46:41 -0700 |
|---|---|---|
| committer | Berker Peksag <berker.peksag@gmail.com> | 2018-09-13 00:46:40 +0300 |
| commit | ec4d099b9f1951b08d1a53181c278173ff6a0cc1 (patch) | |
| tree | c192948103ea114a82efdc5d26cb89236ee70d92 | |
| parent | b608fcd444c00ff37a19d34e4eeadb1221fb6436 (diff) | |
| download | cpython-git-ec4d099b9f1951b08d1a53181c278173ff6a0cc1.tar.gz | |
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 <izbyshev@ispras.ru>
| -rw-r--r-- | Modules/_json.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Modules/_json.c b/Modules/_json.c index 5a9464e34f..ac6e017a4e 100644 --- a/Modules/_json.c +++ b/Modules/_json.c @@ -1374,7 +1374,7 @@ _encoded_const(PyObject *obj) if (s_null == NULL) { s_null = PyUnicode_InternFromString("null"); } - Py_INCREF(s_null); + Py_XINCREF(s_null); return s_null; } else if (obj == Py_True) { @@ -1382,7 +1382,7 @@ _encoded_const(PyObject *obj) if (s_true == NULL) { s_true = PyUnicode_InternFromString("true"); } - Py_INCREF(s_true); + Py_XINCREF(s_true); return s_true; } else if (obj == Py_False) { @@ -1390,7 +1390,7 @@ _encoded_const(PyObject *obj) if (s_false == NULL) { s_false = PyUnicode_InternFromString("false"); } - Py_INCREF(s_false); + Py_XINCREF(s_false); return s_false; } else { |
