Skip to content

Commit

Permalink
bpo-34649: Add missing NULL checks to _encoded_const() (pythonGH-9225)
Browse files Browse the repository at this point in the history
Reported by Svace static analyzer.
  • Loading branch information
izbyshev authored and berkerpeksag committed Sep 12, 2018
1 parent 0dd7180 commit 6f82bff
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Modules/_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -1374,23 +1374,23 @@ _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) {
static PyObject *s_true = NULL;
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) {
static PyObject *s_false = NULL;
if (s_false == NULL) {
s_false = PyUnicode_InternFromString("false");
}
Py_INCREF(s_false);
Py_XINCREF(s_false);
return s_false;
}
else {
Expand Down

0 comments on commit 6f82bff

Please sign in to comment.