File: python-schedutils/schedutils.c
Function: get_affinity
Error: calling PyList_Append with NULL as argument 1 (list) at python-schedutils/schedutils.c:28
8 static PyObject *get_affinity(PyObject *self __unused, PyObject *args)
9 {
10 	PyObject *list;
11 	cpu_set_t cpus;
12 	int pid, cpu;
13 
14 	if (!PyArg_ParseTuple(args, "i", &pid))
15 		return NULL;
when PyArg_ParseTuple() succeeds
taking False path
16 
17 	CPU_ZERO(&cpus);
18 
19 	if (sched_getaffinity(pid, sizeof(cpus), &cpus) < 0) {
20 		PyErr_SetFromErrno(PyExc_SystemError);
when considering range: 0 <= value <= 0x7fffffff
taking False path
21 		return NULL;
22 	}
23 
24 	list = PyList_New(0);
25 	for (cpu = 0; cpu < CPU_SETSIZE; ++cpu)
when PyList_New() fails
26 		if (CPU_ISSET(cpu, &cpus))
taking True path
27 			PyList_Append(list, Py_BuildValue("i", cpu));
taking True path
when considering value == (int)1 from python-schedutils/schedutils.c:27
taking True path
28 
when Py_BuildValue() succeeds
calling PyList_Append with NULL as argument 1 (list) at python-schedutils/schedutils.c:28
PyList_Append() invokes Py_TYPE() on the pointer via the PyList_Check() macro, thus accessing (NULL)->ob_type
found 1 similar trace(s) to this
29 	return list;
30 }
31