Skip to content

Commit 6f82bff

Browse files
Alexey Izbyshevberkerpeksag
Alexey Izbyshev
authored andcommitted
bpo-34649: Add missing NULL checks to _encoded_const() (GH-9225)
Reported by Svace static analyzer.
1 parent 0dd7180 commit 6f82bff

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
@@ -1374,23 +1374,23 @@ _encoded_const(PyObject *obj)
13741374
if (s_null == NULL) {
13751375
s_null = PyUnicode_InternFromString("null");
13761376
}
1377-
Py_INCREF(s_null);
1377+
Py_XINCREF(s_null);
13781378
return s_null;
13791379
}
13801380
else if (obj == Py_True) {
13811381
static PyObject *s_true = NULL;
13821382
if (s_true == NULL) {
13831383
s_true = PyUnicode_InternFromString("true");
13841384
}
1385-
Py_INCREF(s_true);
1385+
Py_XINCREF(s_true);
13861386
return s_true;
13871387
}
13881388
else if (obj == Py_False) {
13891389
static PyObject *s_false = NULL;
13901390
if (s_false == NULL) {
13911391
s_false = PyUnicode_InternFromString("false");
13921392
}
1393-
Py_INCREF(s_false);
1393+
Py_XINCREF(s_false);
13941394
return s_false;
13951395
}
13961396
else {

0 commit comments

Comments
 (0)