File: tests/cpychecker/refcounts/too_many_increfs/input.c
Function: too_many_increfs
Error: ob_refcnt of return value is 1 too high
22 PyObject *
23 too_many_increfs(PyObject *self, PyObject *args)
24 {
25     PyObject *tmp;
26     tmp = PyLong_FromLong(0x1000);
PyLong_FromLong() succeeds
PyLongObject allocated at:     tmp = PyLong_FromLong(0x1000);
27 
28     /* This INCREF is redundant, and introduces a leak (or a read through
29        NULL): */
30     Py_INCREF(tmp);
31     return tmp;
returning
ob_refcnt of return value is 1 too high
32 }



File: tests/cpychecker/refcounts/too_many_increfs/input.c
Function: too_many_increfs
Error: dereferencing NULL (tmp->ob_refcnt) at tests/cpychecker/refcounts/too_many_increfs/input.c:30
22 PyObject *
23 too_many_increfs(PyObject *self, PyObject *args)
24 {
25     PyObject *tmp;
26     tmp = PyLong_FromLong(0x1000);
PyLong_FromLong() fails
27 
28     /* This INCREF is redundant, and introduces a leak (or a read through
29        NULL): */
30     Py_INCREF(tmp);
dereferencing NULL (tmp->ob_refcnt) at tests/cpychecker/refcounts/too_many_increfs/input.c:30
31     return tmp;
32 }