File: Modules/ldapcontrol.c
Function: LDAPControls_from_object
Error: ob_refcnt of new ref from call to _Py_BuildValue_SizeT is 1 too high
125 int
126 LDAPControls_from_object(PyObject* list, LDAPControl ***controls_ret)
127 {
128     Py_ssize_t len, i;
129     LDAPControl** ldcs;
130     LDAPControl* ldc;
131     PyObject* item;
132   
133     if (!PySequence_Check(list)) {
when considering value == (int)0 from Modules/ldapcontrol.c:133
taking True path
134 	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
135 	   "expected a list", list));
136 	return 0;
137     }
138 
139     len = PySequence_Length(list);
140     ldcs = PyMem_NEW(LDAPControl*, len + 1);
141     if (ldcs == NULL) {
142         PyErr_NoMemory();
143         return 0;
144     }
145 
146     for (i = 0; i < len; i++) {
147       item = PySequence_GetItem(list, i);
148       if (item == NULL) {
149           PyMem_DEL(ldcs);
150           return 0;
151       }
152 
153       ldc = Tuple_to_LDAPControl(item);
154       if (ldc == NULL) {
155           Py_DECREF(item);
156           PyMem_DEL(ldcs);
157           return 0;
158       }
159 
160       ldcs[i] = ldc;
161       Py_DECREF(item);
162     }
163 
164     ldcs[len] = NULL;
165     *controls_ret = ldcs;
166     return 1;
167 }
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