File: demo.c
Function: make_a_list_of_random_ints_badly
Error: ob_refcnt of '*item' is 1 too high
83 PyObject *
84 make_a_list_of_random_ints_badly(PyObject *self,
85                                  PyObject *args)
86 {
87     PyObject *list, *item;
88     long count, i;
89 
90     if (!PyArg_ParseTuple(args, "i", &count)) {
1 when PyArg_ParseTuple() succeeds
2 taking False path reaching: list = PyList_New(0);
91 return NULL; 92 } 93 94 list = PyList_New(0);
3 when PyList_New() succeeds
95 96 for (i = 0; i < count; i++) {
4 when considering range: 1 <= count.0 <= 0x7fffffff
5 taking True path reaching: item = PyLong_FromLong(random());
8 when considering count.0 == (int)1 from demo.c:90
9 taking False path reaching: return list;
97 item = PyLong_FromLong(random());
6 when PyLong_FromLong() succeeds ob_refcnt is now refs: 1 + N where N >= 0
98 PyList_Append(list, item);
7 when PyList_Append() succeeds ob_refcnt is now refs: 2 + N where N >= 0 '*item' is now referenced by 1 non-stack value(s): PyListObject.ob_item[0]
99 } 100 101 return list; 102 } ob_refcnt of '*item' is 1 too high

File: demo.c
Function: make_a_list_of_random_ints_badly
Error: ob_refcnt of '*item' is 1 too high
83 PyObject *
84 make_a_list_of_random_ints_badly(PyObject *self,
85                                  PyObject *args)
86 {
87     PyObject *list, *item;
88     long count, i;
89 
90     if (!PyArg_ParseTuple(args, "i", &count)) {
1 when PyArg_ParseTuple() succeeds
2 taking False path reaching: list = PyList_New(0);
91 return NULL; 92 } 93 94 list = PyList_New(0);
3 when PyList_New() succeeds
95 96 for (i = 0; i < count; i++) {
4 when considering range: 1 <= count.0 <= 0x7fffffff
5 taking True path reaching: item = PyLong_FromLong(random());
8 when considering count.0 == (int)1 from demo.c:90
9 taking False path reaching: return list;
97 item = PyLong_FromLong(random());
6 when PyLong_FromLong() succeeds ob_refcnt is now refs: 1 + N where N >= 0
98 PyList_Append(list, item);
7 when PyList_Append() fails
99 } 100 101 return list; 102 } ob_refcnt of '*item' is 1 too high

File: demo.c
Function: make_a_list_of_random_ints_badly
Error: calling PyList_Append with NULL as argument 1 (list) at demo.c:98
83 PyObject *
84 make_a_list_of_random_ints_badly(PyObject *self,
85                                  PyObject *args)
86 {
87     PyObject *list, *item;
88     long count, i;
89 
90     if (!PyArg_ParseTuple(args, "i", &count)) {
1 when PyArg_ParseTuple() succeeds
2 taking False path reaching: list = PyList_New(0);
91 return NULL; 92 } 93 94 list = PyList_New(0);
3 when PyList_New() fails
95 96 for (i = 0; i < count; i++) {
4 when considering range: 1 <= count.0 <= 0x7fffffff
5 taking True path reaching: item = PyLong_FromLong(random());
97 item = PyLong_FromLong(random());
6 when PyLong_FromLong() succeeds
98 PyList_Append(list, item); calling PyList_Append with NULL as argument 1 (list) at demo.c:98 99 } 100 101 return list; 102 }

File: demo.c
Function: make_a_list_of_random_ints_badly
Error: calling PyList_Append with NULL as argument 1 (list) at demo.c:98
83 PyObject *
84 make_a_list_of_random_ints_badly(PyObject *self,
85                                  PyObject *args)
86 {
87     PyObject *list, *item;
88     long count, i;
89 
90     if (!PyArg_ParseTuple(args, "i", &count)) {
1 when PyArg_ParseTuple() succeeds
2 taking False path reaching: list = PyList_New(0);
91 return NULL; 92 } 93 94 list = PyList_New(0);
3 when PyList_New() fails
95 96 for (i = 0; i < count; i++) {
4 when considering range: 1 <= count.0 <= 0x7fffffff
5 taking True path reaching: item = PyLong_FromLong(random());
97 item = PyLong_FromLong(random());
6 when PyLong_FromLong() fails
98 PyList_Append(list, item); calling PyList_Append with NULL as argument 1 (list) at demo.c:98 99 } 100 101 return list; 102 }