summaryrefslogtreecommitdiff
path: root/source4/param
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2011-03-21 10:32:24 +0100
committerMatthias Dieter Wallnöfer <mdw@samba.org>2011-03-22 19:52:57 +0100
commit3940777a14a93dbf88fcc9e43452fc2f84a7b6fc (patch)
tree095b34cf3ba9914876bc8e72f8d5f23f3c9b7ba8 /source4/param
parent5d09acab7e5e671f244d69f59d1714a16bdb93fb (diff)
downloadsamba-3940777a14a93dbf88fcc9e43452fc2f84a7b6fc.tar.gz
samba-3940777a14a93dbf88fcc9e43452fc2f84a7b6fc.tar.bz2
samba-3940777a14a93dbf88fcc9e43452fc2f84a7b6fc.zip
s4:python bindings - handle NULL returns from "loadparm_init_global"
Reviewed-by: Jelmer Autobuild-User: Matthias Dieter Wallnöfer <mdw@samba.org> Autobuild-Date: Tue Mar 22 19:52:57 CET 2011 on sn-devel-104
Diffstat (limited to 'source4/param')
-rw-r--r--source4/param/pyparam.c4
-rw-r--r--source4/param/pyparam_util.c3
2 files changed, 7 insertions, 0 deletions
diff --git a/source4/param/pyparam.c b/source4/param/pyparam.c
index a248215fd9..3ba8146860 100644
--- a/source4/param/pyparam.c
+++ b/source4/param/pyparam.c
@@ -335,6 +335,10 @@ static PyObject *py_lp_ctx_new(PyTypeObject *type, PyObject *args, PyObject *kwa
return NULL;
}
ret->ptr = loadparm_init_global(false);
+ if (ret->ptr == NULL) {
+ PyErr_NoMemory();
+ return NULL;
+ }
return (PyObject *)ret;
}
diff --git a/source4/param/pyparam_util.c b/source4/param/pyparam_util.c
index 528c007624..cbf2095e85 100644
--- a/source4/param/pyparam_util.c
+++ b/source4/param/pyparam_util.c
@@ -35,6 +35,9 @@ _PUBLIC_ struct loadparm_context *lpcfg_from_py_object(TALLOC_CTX *mem_ctx, PyOb
if (PyString_Check(py_obj)) {
lp_ctx = loadparm_init_global(false);
+ if (lp_ctx == NULL) {
+ return NULL;
+ }
if (!lpcfg_load(lp_ctx, PyString_AsString(py_obj))) {
PyErr_Format(PyExc_RuntimeError, "Unable to load %s",
PyString_AsString(py_obj));