-
Notifications
You must be signed in to change notification settings - Fork 127
Open
Labels
Description
The function encode_assertion_control
creates a temporary LDAP* struct. This seems pretty wasteful and causes a memory leak #79. We should find a simpler way to encode assertion controls.
python-ldap/Modules/ldapcontrol.c
Lines 333 to 360 in c84b4fa
static PyObject* | |
encode_assertion_control(PyObject *self, PyObject *args) | |
{ | |
int err; | |
PyObject *res = 0; | |
char *assertion_filterstr; | |
struct berval ctrl_val; | |
LDAP *ld = NULL; | |
if (!PyArg_ParseTuple(args, "s:encode_assertion_control", | |
&assertion_filterstr)) { | |
goto endlbl; | |
} | |
err = ldap_create(&ld); | |
if (err != LDAP_SUCCESS) | |
return LDAPerror(ld, "ldap_create"); | |
err = ldap_create_assertion_control_value(ld,assertion_filterstr,&ctrl_val); | |
if (err != LDAP_SUCCESS) | |
return LDAPerror(ld, "ldap_create_assertion_control_value"); | |
res = LDAPberval_to_object(&ctrl_val); | |
endlbl: | |
return res; | |
} |