Skip to content

Commit 6d72686

Browse files
miss-islingtonAlexey Izbyshev
authored andcommitted
bpo-34649: Add missing NULL checks to _encoded_const() (GH-9225)
Reported by Svace static analyzer. (cherry picked from commit 6f82bff) Co-authored-by: Alexey Izbyshev <[email protected]>
1 parent 5a435ea commit 6d72686

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Modules/_json.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,23 +1376,23 @@ _encoded_const(PyObject *obj)
13761376
if (s_null == NULL) {
13771377
s_null = PyUnicode_InternFromString("null");
13781378
}
1379-
Py_INCREF(s_null);
1379+
Py_XINCREF(s_null);
13801380
return s_null;
13811381
}
13821382
else if (obj == Py_True) {
13831383
static PyObject *s_true = NULL;
13841384
if (s_true == NULL) {
13851385
s_true = PyUnicode_InternFromString("true");
13861386
}
1387-
Py_INCREF(s_true);
1387+
Py_XINCREF(s_true);
13881388
return s_true;
13891389
}
13901390
else if (obj == Py_False) {
13911391
static PyObject *s_false = NULL;
13921392
if (s_false == NULL) {
13931393
s_false = PyUnicode_InternFromString("false");
13941394
}
1395-
Py_INCREF(s_false);
1395+
Py_XINCREF(s_false);
13961396
return s_false;
13971397
}
13981398
else {

0 commit comments

Comments
 (0)