Skip to content

LDAPControls_to_List() may return partly filled list #22

@tiran

Description

@tiran

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;

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy