summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-12-12 18:54:56 +0100
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-12-12 20:06:24 +0100
commitf9b87352f40c04446bd2456064088df2510e8f70 (patch)
tree1d39be49d426d7cbe1241c5013a4e366d3dc7c0e
parentc8d888772a855b6f9b7f4b06412b1b4c84174ef8 (diff)
downloadsamba-f9b87352f40c04446bd2456064088df2510e8f70.tar.gz
samba-f9b87352f40c04446bd2456064088df2510e8f70.tar.bz2
samba-f9b87352f40c04446bd2456064088df2510e8f70.zip
s4:libnet/py_net.c - add checks for OOM conditions
-rw-r--r--source4/libnet/py_net.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source4/libnet/py_net.c b/source4/libnet/py_net.c
index 9775e246ed..9f53f8949a 100644
--- a/source4/libnet/py_net.c
+++ b/source4/libnet/py_net.c
@@ -55,6 +55,10 @@ static PyObject *py_net_join(py_net_Object *self, PyObject *args, PyObject *kwar
return NULL;
mem_ctx = talloc_new(self->mem_ctx);
+ if (mem_ctx == NULL) {
+ PyErr_NoMemory();
+ return NULL;
+ }
status = libnet_Join(self->libnet_ctx, mem_ctx, &r);
if (NT_STATUS_IS_ERR(status)) {
@@ -95,7 +99,12 @@ static PyObject *py_net_set_password(py_net_Object *self, PyObject *args, PyObje
/* FIXME: we really need to get a context from the caller or we may end
* up with 2 event contexts */
ev = s4_event_context_init(NULL);
+
mem_ctx = talloc_new(ev);
+ if (mem_ctx == NULL) {
+ PyErr_NoMemory();
+ return NULL;
+ }
status = libnet_SetPassword(self->libnet_ctx, mem_ctx, &r);
if (NT_STATUS_IS_ERR(status)) {
@@ -131,6 +140,10 @@ static PyObject *py_net_export_keytab(py_net_Object *self, PyObject *args, PyObj
}
mem_ctx = talloc_new(self->mem_ctx);
+ if (mem_ctx == NULL) {
+ PyErr_NoMemory();
+ return NULL;
+ }
status = libnet_export_keytab(self->libnet_ctx, mem_ctx, &r);
if (NT_STATUS_IS_ERR(status)) {