s4/pyauth: insist on proper ldb in context_new()
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Wed, 2 May 2018 22:26:34 +0000 (10:26 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 1 Feb 2019 02:36:17 +0000 (03:36 +0100)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/auth/pyauth.c

index a9a1ee10fcfb259047372de6b4bcb104186d73eb..0736859092c990b5a1aeb14a598939fdb43622c5 100644 (file)
@@ -353,6 +353,10 @@ static PyObject *py_auth_context_new(PyTypeObject *type, PyObject *args, PyObjec
 
        if (py_ldb != Py_None) {
                ldb = pyldb_Ldb_AsLdbContext(py_ldb);
+               if (ldb == NULL) {
+                       talloc_free(mem_ctx);
+                       return NULL;
+               }
        }
 
        lp_ctx = lpcfg_from_py_object(mem_ctx, py_lp_ctx);