File: alsaaudio.c
Function: alsapcm_polldescriptors
Error: ob_refcnt of '*result' is 1 too high
764 static PyObject *
765 alsapcm_polldescriptors(alsapcm_t *self, PyObject *args)
766 {
767     int i, count, rc;
768     PyObject *result;
769     struct pollfd *fds;
770 
771     if (!PyArg_ParseTuple(args,":polldescriptors"))
when PyArg_ParseTuple() succeeds
taking False path
772         return NULL;
773 
774     if (!self->handle)
when treating unknown struct snd_pcm_t * from alsaaudio.c:774 as non-NULL
taking False path
775     {
776         PyErr_SetString(ALSAAudioError, "PCM device is closed");
777         return NULL;
778     }
779 
780     count = snd_pcm_poll_descriptors_count(self->handle);
781     if (count < 0)
when considering range: 0 <= value <= 0x7fffffff
taking False path
782     {
783         PyErr_SetString(ALSAAudioError,"Can't get poll descriptor count");
784         return NULL;
785     }
786 
787     fds = (struct pollfd*)calloc(count, sizeof(struct pollfd));
788     if (!fds)
when treating unknown void * from alsaaudio.c:787 as non-NULL
taking False path
789     {
790         PyErr_SetString(PyExc_MemoryError, "Out of memory");
791         return NULL;
792     }
793 
794     result = PyList_New(count);
when PyList_New() succeeds
PyListObject allocated at:     result = PyList_New(count);
ob_refcnt is now refs: 1 + N where N >= 0
795     rc = snd_pcm_poll_descriptors(self->handle, fds, (unsigned int)count);
796     if (rc != count)
when taking True path
797     {
798         PyErr_SetString(ALSAAudioError,"Can't get poll descriptors");
calling PyErr_SetString()
799         return NULL;
800     }
801 
802     for (i = 0; i < count; ++i)
803     {
804         PyList_SetItem(result, i,
805                        Py_BuildValue("II", fds[i].fd, fds[i].events));
806     }
807 
808     return result;
809 }
ob_refcnt of '*result' is 1 too high
was expecting final ob_refcnt to be N + 0 (for some unknown N)
but final ob_refcnt is N + 1

File: alsaaudio.c
Function: alsapcm_polldescriptors
Error: calling PyList_SetItem with NULL as argument 1 (result) at alsaaudio.c:804
764 static PyObject *
765 alsapcm_polldescriptors(alsapcm_t *self, PyObject *args)
766 {
767     int i, count, rc;
768     PyObject *result;
769     struct pollfd *fds;
770 
771     if (!PyArg_ParseTuple(args,":polldescriptors"))
when PyArg_ParseTuple() succeeds
taking False path
772         return NULL;
773 
774     if (!self->handle)
when treating unknown struct snd_pcm_t * from alsaaudio.c:774 as non-NULL
taking False path
775     {
776         PyErr_SetString(ALSAAudioError, "PCM device is closed");
777         return NULL;
778     }
779 
780     count = snd_pcm_poll_descriptors_count(self->handle);
781     if (count < 0)
when considering range: 0 <= value <= 0x7fffffff
taking False path
782     {
783         PyErr_SetString(ALSAAudioError,"Can't get poll descriptor count");
784         return NULL;
785     }
786 
787     fds = (struct pollfd*)calloc(count, sizeof(struct pollfd));
788     if (!fds)
when treating unknown void * from alsaaudio.c:787 as non-NULL
taking False path
789     {
790         PyErr_SetString(PyExc_MemoryError, "Out of memory");
791         return NULL;
792     }
793 
794     result = PyList_New(count);
when PyList_New() fails
795     rc = snd_pcm_poll_descriptors(self->handle, fds, (unsigned int)count);
796     if (rc != count)
when taking False path
797     {
798         PyErr_SetString(ALSAAudioError,"Can't get poll descriptors");
799         return NULL;
800     }
801 
802     for (i = 0; i < count; ++i)
when considering range: 1 <= count <= 0x7fffffff
taking True path
803     {
804         PyList_SetItem(result, i,
when Py_BuildValue() succeeds
calling PyList_SetItem with NULL as argument 1 (result) at alsaaudio.c:804
PyList_SetItem() invokes Py_TYPE() on the pointer via the PyList_Check() macro, thus accessing (NULL)->ob_type
found 1 similar trace(s) to this
805                        Py_BuildValue("II", fds[i].fd, fds[i].events));
806     }
807 
808     return result;
809 }