File: alsaaudio.c
Function: alsamixer_getenum
Error: ob_refcnt of '*result' is 1 too high
1529 static PyObject *
1530 alsamixer_getenum(alsamixer_t *self, PyObject *args) 
1531 {
1532     snd_mixer_elem_t *elem;
1533     PyObject *elems;
1534     int i, count, rc;
1535     unsigned int index;
1536     char name[32];
1537     PyObject *result;
1538 
1539     if (!PyArg_ParseTuple(args, ":getenum")) 
when PyArg_ParseTuple() succeeds
taking False path
1540         return NULL;
1541 
1542     if (!self->handle) 
when treating unknown struct snd_mixer_t * from alsaaudio.c:1542 as non-NULL
taking False path
1543     {
1544         PyErr_SetString(ALSAAudioError, "Mixer is closed");
1545         return NULL;
1546     }
1547     
1548     elem = alsamixer_find_elem(self->handle,self->controlname,self->controlid);
1549     if (!snd_mixer_selem_is_enumerated(elem)) {
when considering range: -0x80000000 <= value <= -1
taking False path
1550         // Not an enumerated control, return an empty tuple
1551         return PyTuple_New(0);
1552     }
1553     
1554     count = snd_mixer_selem_get_enum_items(elem);
1555     if (count < 0) 
when considering range: 0 <= value <= 0x7fffffff
taking False path
1556     {
1557         PyErr_SetString(ALSAAudioError, snd_strerror(count));
1558         return NULL;
1559     }
1560 
1561     result = PyTuple_New(2);
when PyTuple_New() succeeds
PyTupleObject allocated at:     result = PyTuple_New(2);
ob_refcnt is now refs: 1 + N where N >= 0
1562     if (!result)
taking False path
1563         return NULL;
1564     
1565     rc = snd_mixer_selem_get_enum_item(elem, 0, &index);
1566     if(rc) 
when considering range: -0x80000000 <= value <= -1
taking True path
1567     {
1568         PyErr_SetString(ALSAAudioError, snd_strerror(rc));
calling PyErr_SetString()
1569         return NULL;
1570     }
1571     rc = snd_mixer_selem_get_enum_item_name(elem, index, sizeof(name)-1, name);
1572     if (rc) 
1573     {
1574         Py_DECREF(result);
1575         PyErr_SetString(ALSAAudioError, snd_strerror(rc));
1576         return NULL;
1577     }  
1578   
1579     PyTuple_SetItem(result, 0, PyUnicode_FromString(name));
1580 
1581     elems = PyList_New(count);
1582     if (!elems)
1583     {
1584         Py_DECREF(result);
1585         return NULL;
1586     }
1587 
1588     for (i = 0; i < count; ++i) 
1589     {
1590         rc = snd_mixer_selem_get_enum_item_name(elem, i, sizeof(name)-1, name);
1591         if (rc) {
1592             Py_DECREF(elems);
1593             Py_DECREF(result);
1594             PyErr_SetString(ALSAAudioError, snd_strerror(rc));
1595             return NULL;
1596         }
1597         
1598         PyList_SetItem(elems, i, PyUnicode_FromString(name));
1599     }
1600     
1601     PyTuple_SetItem(result, 1, elems);
1602 
1603     return result;
1604 }
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