[Python-checkins] bpo-34649: Add missing NULL checks to _encoded_const() (GH-9225)
Berker Peksag
webhook-mailer at python.org
Wed Sep 12 18:00:14 EDT 2018
https://github.com/python/cpython/commit/6d726868cd1743623a28b8e048e31b9c3c52a399
commit: 6d726868cd1743623a28b8e048e31b9c3c52a399
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Berker Peksag <berker.peksag at gmail.com>
date: 2018-09-13T01:00:11+03:00
summary:
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 at ispras.ru>
files:
M Modules/_json.c
diff --git a/Modules/_json.c b/Modules/_json.c
index 8f1743bada87..dad6b01f822f 100644
--- a/Modules/_json.c
+++ b/Modules/_json.c
@@ -1376,7 +1376,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) {
@@ -1384,7 +1384,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) {
@@ -1392,7 +1392,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 {
More information about the Python-checkins
mailing list