Skip to content

encode_assertion_control creates temporary LDAP* struct #86

Open
@tiran

Description

@tiran

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.

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;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions