File: pyalsa/alsacard.c
Function: device_name_hint
Error: ob_refcnt of '*d' is 1 too high
162 static PyObject *
163 device_name_hint(PyObject *self, PyObject *args, PyObject *kwds)
164 {
165 	int card, res;
166 	char *iface, **hint;
167 	void **hints;
168 	static char * kwlist[] = { "card", "interface", NULL };
169 	static char * ids[] = { "NAME", "DESC", "IOID", NULL };
170 	PyObject *l, *d, *v;
171 	char **id, *str;
172 
173 	if (!PyArg_ParseTupleAndKeywords(args, kwds, "is", kwlist, &card, &iface))
when PyArg_ParseTupleAndKeywords() succeeds
taking False path
174 		Py_RETURN_NONE;
175 
176 	res = snd_device_name_hint(card, iface, &hints);
177 	if (res)
when considering value == (int)0 from pyalsa/alsacard.c:176
taking False path
178 		return PyErr_Format(PyExc_IOError, "Cannot get card longname: %s", snd_strerror(res));
179 
180 	l = PyList_New(0);
when PyList_New() succeeds
181 
182 	hint = (char **)hints;
183 	while (*hint) {
when treating unknown void * * * from pyalsa/alsacard.c:176 as non-NULL
when treating unknown char * from pyalsa/alsacard.c:183 as non-NULL
taking True path
when treating unknown char * from pyalsa/alsacard.c:183 as NULL
taking False path
184 		d = PyDict_New();
when PyDict_New() succeeds
PyDictObject allocated at: 		d = PyDict_New();
ob_refcnt is now refs: 1 + N where N >= 0
185 		if (d == NULL)
taking False path
186 			goto err1;
187 		id = ids;
188 		while (*id) {
when treating unknown char * from pyalsa/alsacard.c:188 as non-NULL
taking True path
189 			str = snd_device_name_get_hint(*hint, *id);
190 			if (str == NULL)
when treating unknown char * from pyalsa/alsacard.c:189 as NULL
taking True path
191 				break;
192 			v = PyString_FromString(str);
193 			free(str);
194 			if (v == NULL)
195 				goto err1;
196 			if (PyDict_SetItemString(d, *id, v))
197 				goto err1;
198 			id++;
199 		}
200 		if (PyList_Append(l, d))
when PyList_Append() succeeds
taking False path
ob_refcnt is now refs: 2 + N where N >= 0
'*d' is now referenced by 1 non-stack value(s): PyListObject.ob_item[0]
201 			goto err1;
202 		hint++;
203 	}
204 	
205 	snd_device_name_free_hint(hints);
206 	return l;
207 
208       err1:
209       	Py_XDECREF(d);
210       	Py_XDECREF(l);
211 	snd_device_name_free_hint(hints);
212 	return NULL;
213 }
ob_refcnt of '*d' is 1 too high
was expecting final ob_refcnt to be N + 1 (for some unknown N)
due to object being referenced by: PyListObject.ob_item[0]
but final ob_refcnt is N + 2
found 1 similar trace(s) to this

File: pyalsa/alsacard.c
Function: device_name_hint
Error: ob_refcnt of '*v' is 1 too high
162 static PyObject *
163 device_name_hint(PyObject *self, PyObject *args, PyObject *kwds)
164 {
165 	int card, res;
166 	char *iface, **hint;
167 	void **hints;
168 	static char * kwlist[] = { "card", "interface", NULL };
169 	static char * ids[] = { "NAME", "DESC", "IOID", NULL };
170 	PyObject *l, *d, *v;
171 	char **id, *str;
172 
173 	if (!PyArg_ParseTupleAndKeywords(args, kwds, "is", kwlist, &card, &iface))
when PyArg_ParseTupleAndKeywords() succeeds
taking False path
174 		Py_RETURN_NONE;
175 
176 	res = snd_device_name_hint(card, iface, &hints);
177 	if (res)
when considering value == (int)0 from pyalsa/alsacard.c:176
taking False path
178 		return PyErr_Format(PyExc_IOError, "Cannot get card longname: %s", snd_strerror(res));
179 
180 	l = PyList_New(0);
when PyList_New() succeeds
181 
182 	hint = (char **)hints;
183 	while (*hint) {
when treating unknown void * * * from pyalsa/alsacard.c:176 as non-NULL
when treating unknown char * from pyalsa/alsacard.c:183 as non-NULL
taking True path
when treating unknown char * from pyalsa/alsacard.c:183 as NULL
taking False path
184 		d = PyDict_New();
when PyDict_New() succeeds
185 		if (d == NULL)
taking False path
186 			goto err1;
187 		id = ids;
188 		while (*id) {
when treating unknown char * from pyalsa/alsacard.c:188 as non-NULL
taking True path
when treating unknown char * from pyalsa/alsacard.c:188 as NULL
taking False path
189 			str = snd_device_name_get_hint(*hint, *id);
190 			if (str == NULL)
when treating unknown char * from pyalsa/alsacard.c:189 as non-NULL
taking False path
191 				break;
192 			v = PyString_FromString(str);
when PyString_FromString() succeeds
PyStringObject allocated at: 			v = PyString_FromString(str);
ob_refcnt is now refs: 1 + N where N >= 0
193 			free(str);
194 			if (v == NULL)
taking False path
195 				goto err1;
196 			if (PyDict_SetItemString(d, *id, v))
when treating unknown char * from pyalsa/alsacard.c:196 as non-NULL
when PyDict_SetItemString() succeeds
taking False path
ob_refcnt is now refs: 1 + N where N >= 1
197 				goto err1;
198 			id++;
199 		}
200 		if (PyList_Append(l, d))
when PyList_Append() succeeds
taking False path
201 			goto err1;
202 		hint++;
203 	}
204 	
205 	snd_device_name_free_hint(hints);
206 	return l;
207 
208       err1:
209       	Py_XDECREF(d);
210       	Py_XDECREF(l);
211 	snd_device_name_free_hint(hints);
212 	return NULL;
213 }
ob_refcnt of '*v' is 1 too high
was expecting final ob_refcnt to be N + 0 (for some unknown N)
but final ob_refcnt is N + 1
found 8 similar trace(s) to this