-
Notifications
You must be signed in to change notification settings - Fork 127
Closed
Description
LDAPControls_to_List()
may return a partly filled list in case Py_BuildValue()
fails. In case of an error, the function should DECREF the list and return NULL.
Also this part is just odd:
Py_INCREF(res);
endlbl:
Py_XDECREF(res);
return res;
python-ldap/Modules/ldapcontrol.c
Lines 169 to 195 in 52077e8
LDAPControls_to_List(LDAPControl **ldcs) | |
{ | |
PyObject *res = 0, *pyctrl; | |
LDAPControl **tmp = ldcs; | |
Py_ssize_t num_ctrls = 0, i; | |
if (tmp) | |
while (*tmp++) num_ctrls++; | |
if (!(res = PyList_New(num_ctrls))) | |
goto endlbl; | |
for (i = 0; i < num_ctrls; i++) { | |
if (!(pyctrl = Py_BuildValue("sbO&", ldcs[i]->ldctl_oid, | |
ldcs[i]->ldctl_iscritical, | |
LDAPberval_to_object, | |
&ldcs[i]->ldctl_value))) { | |
goto endlbl; | |
} | |
PyList_SET_ITEM(res, i, pyctrl); | |
} | |
Py_INCREF(res); | |
endlbl: | |
Py_XDECREF(res); | |
return res; | |
} |
Metadata
Metadata
Assignees
Labels
No labels