libnet: Add NULL checks to py_net_finddc
authorVolker Lendecke <vl@samba.org>
Tue, 9 Jan 2018 09:23:35 +0000 (10:23 +0100)
committerVolker Lendecke <vl@samba.org>
Tue, 9 Jan 2018 17:25:07 +0000 (18:25 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source4/libnet/py_net.c

index 7ddee2df92c6ef5b84f4bcecb272f1ee10342fc7..0567dbd6353d0c6328f8ac6ee532782e7fd514cb 100644 (file)
@@ -697,8 +697,18 @@ static PyObject *py_net_finddc(py_net_Object *self, PyObject *args, PyObject *kw
        }
 
        mem_ctx = talloc_new(self->mem_ctx);
+       if (mem_ctx == NULL) {
+               PyErr_NoMemory();
+               return NULL;
+       }
 
        io = talloc_zero(mem_ctx, struct finddcs);
+       if (io == NULL) {
+               TALLOC_FREE(mem_ctx);
+               PyErr_NoMemory();
+               return NULL;
+       }
+
        if (domain != NULL) {
                io->in.domain_name = domain;
        }