File: Modules/ldapcontrol.c
Function: Tuple_to_LDAPControl
Error: ob_refcnt of new ref from call to _Py_BuildValue_SizeT is 1 too high
65 static LDAPControl*
66 Tuple_to_LDAPControl( PyObject* tup )
67 {
68     char *oid;
69     char iscritical;
70     struct berval berbytes;
71     PyObject *bytes;
72     LDAPControl *lc = NULL;
73     Py_ssize_t len;
74 
75     if (!PyTuple_Check(tup)) {
when considering value == (long int)0 from Modules/ldapcontrol.c:75
taking True path
76 	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
77 	   "expected a tuple", tup));
78 	return NULL;
79     }
80 
81     if (!PyArg_ParseTuple( tup, "sbO", &oid, &iscritical, &bytes ))
82         return NULL;
83   
84     lc = PyMem_NEW(LDAPControl, 1);
85     if (lc == NULL) {
86         PyErr_NoMemory();
87         return NULL;
88     }
89 
90     lc->ldctl_iscritical = iscritical;
91 
92     len = strlen(oid);
93     lc->ldctl_oid = PyMem_NEW(char, len + 1);
94     if (lc->ldctl_oid == NULL) {
95         PyErr_NoMemory();
96         LDAPControl_DEL(lc);
97         return NULL;
98     }
99     memcpy(lc->ldctl_oid, oid, len + 1);
100 
101     /* The berval can either be None or a String */
102     if (PyNone_Check(bytes)) {
103         berbytes.bv_len = 0;
104         berbytes.bv_val = NULL;
105     }
106     else if (PyString_Check(bytes)) {
107         berbytes.bv_len = PyString_Size(bytes);
108         berbytes.bv_val = PyString_AsString(bytes);
109     }
110     else {
111 	PyErr_SetObject(PyExc_TypeError, Py_BuildValue("sO",
112             "expected a string", bytes));
113         LDAPControl_DEL(lc);
114         return NULL;
115     }
116     
117     lc->ldctl_value = berbytes;
118 
119     return lc;
120 }
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