Commit 669429fb authored by Miss Islington (bot)'s avatar Miss Islington (bot) Committed by Berker Peksag

bpo-34649: Add missing NULL checks to _encoded_const() (GH-9225)

Reported by Svace static analyzer.
(cherry picked from commit 6f82bffd)
Co-authored-by: default avatarAlexey Izbyshev <izbyshev@ispras.ru>
parent b36567be
......@@ -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 {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment