diff --git a/Modules/LDAPObject.c b/Modules/LDAPObject.c index a2ff626..e06f47c 100644 --- a/Modules/LDAPObject.c +++ b/Modules/LDAPObject.c @@ -126,6 +126,7 @@ Tuple_to_LDAPMod(PyObject *tup, int no_op) } lm = PyMem_NEW(LDAPMod, 1); + if (lm == NULL) goto nomem; @@ -236,6 +237,7 @@ List_to_LDAPMods(PyObject *list, int no_op) } lms = PyMem_NEW(LDAPMod *, len + 1); + if (lms == NULL) goto nomem; diff --git a/Modules/ldapcontrol.c b/Modules/ldapcontrol.c index 17f52cb..5e2d2ff 100644 --- a/Modules/ldapcontrol.c +++ b/Modules/ldapcontrol.c @@ -82,6 +82,7 @@ Tuple_to_LDAPControl(PyObject *tup) return NULL; lc = PyMem_NEW(LDAPControl, 1); + if (lc == NULL) { PyErr_NoMemory(); return NULL; @@ -91,6 +92,7 @@ Tuple_to_LDAPControl(PyObject *tup) len = strlen(oid); lc->ldctl_oid = PyMem_NEW(char, len + 1); + if (lc->ldctl_oid == NULL) { PyErr_NoMemory(); LDAPControl_DEL(lc); @@ -137,6 +139,7 @@ LDAPControls_from_object(PyObject *list, LDAPControl ***controls_ret) len = PySequence_Length(list); ldcs = PyMem_NEW(LDAPControl *, len + 1); + if (ldcs == NULL) { PyErr_NoMemory(); return 0;