258 int
259 attrs_from_List( PyObject *attrlist, char***attrsp ) {
260
261 char **attrs = NULL;
262 Py_ssize_t i, len;
263 PyObject *item;
264
265 if (attrlist == Py_None) {
taking False path
266 /* None means a NULL attrlist */
267 } else if (PyString_Check(attrlist)) {
when considering value == (long int)0 from Modules/LDAPObject.c:267
taking False path
268 /* caught by John Benninghoff <johnb@netscape.com> */
269 PyErr_SetObject( PyExc_TypeError, Py_BuildValue("sO",
270 "expected *list* of strings, not a string", attrlist ));
271 goto error;
272 } else if (PySequence_Check(attrlist)) {
when considering range: -0x80000000 <= value <= -1
taking True path
273 len = PySequence_Length(attrlist);
when PySequence_Size() succeeds
274 attrs = PyMem_NEW(char *, len + 1);
when considering range: 1 <= value <= 0xfffffffffffffff
taking True path
taking True path
taking True path
275 if (attrs == NULL)
when treating unknown void * from Modules/LDAPObject.c:274 as non-NULL
taking False path
276 goto nomem;
277
278 for (i = 0; i < len; i++) {
when considering range: 1 <= len <= 0x7fffffffffffffff
taking True path
279 attrs[i] = NULL;
280 item = PySequence_GetItem(attrlist, i);
when PySequence_GetItem() succeeds
281 if (item == NULL)
taking False path
282 goto error;
283 if (!PyString_Check(item)) {
when considering value == (long int)0 from Modules/LDAPObject.c:283
taking True path
284 PyErr_SetObject(PyExc_TypeError, Py_BuildValue("sO",
when _Py_BuildValue_SizeT() succeeds
calling PyErr_SetObject()
new ref from call to _Py_BuildValue_SizeT allocated at: PyErr_SetObject(PyExc_TypeError, Py_BuildValue("sO",
ob_refcnt is now refs: 1 + N where N >= 0
ob_refcnt is now refs: 1 + N where N >= 1
285 "expected string in list", item));
286 Py_DECREF(item);
taking True path
287 goto error;
288 }
289 attrs[i] = PyString_AsString(item);
290 Py_DECREF(item);
291 }
292 attrs[len] = NULL;
293 } else {
294 PyErr_SetObject( PyExc_TypeError, Py_BuildValue("sO",
295 "expected list of strings or None", attrlist ));
296 goto error;
297 }
298
299 *attrsp = attrs;
300 return 1;
301
302 nomem:
303 PyErr_NoMemory();
304 error:
305 free_attrs(&attrs);
306 return 0;
307 }
ob_refcnt of new ref from call to _Py_BuildValue_SizeT is 1 too high
was expecting final ob_refcnt to be N + 0 (for some unknown N)
but final ob_refcnt is N + 1