File: Modules/LDAPObject.c
Function: List_to_LDAPMods
Error: ob_refcnt of new ref from call to _Py_BuildValue_SizeT is 1 too high
206 static LDAPMod**
207 List_to_LDAPMods( PyObject *list, int no_op ) {
208 
209     Py_ssize_t i, len;
210     LDAPMod** lms;
211     PyObject *item;
212 
213     if (!PySequence_Check(list)) {
when considering range: -0x80000000 <= value <= -1
taking False path
214         PyErr_SetObject( PyExc_TypeError, Py_BuildValue("sO",
215                         "expected list of tuples", list ));
216         return NULL;
217     }
218 
219     len = PySequence_Length(list);
when PySequence_Size() fails
220 
221     if (len < 0) {
taking True path
222         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
223                          "expected list of tuples", list ));
224         return NULL;
225     }
226 
227     lms = PyMem_NEW(LDAPMod *, len + 1);
228     if (lms == NULL) 
229         goto nomem;
230 
231     for (i = 0; i < len; i++) {
232         lms[i] = NULL;
233         item = PySequence_GetItem(list, i);
234         if (item == NULL) 
235             goto error;
236         lms[i] = Tuple_to_LDAPMod(item, no_op);
237         Py_DECREF(item);
238         if (lms[i] == NULL)
239             goto error;
240     }
241     lms[len] = NULL;
242     return lms;
243 
244 nomem:
245     PyErr_NoMemory();
246 error:
247     if (lms)
248         LDAPMods_DEL(lms);
249     return NULL;
250 }
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
found 1 similar trace(s) to this