diff options
author | Noel Power <noel.power@suse.com> | 2020-03-16 15:54:00 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2020-03-19 20:46:42 +0000 |
commit | 9e84f1e5767c23c0e75a0954ac9c3668d18baa30 (patch) | |
tree | 52f5a5a346c7a9defa8cb13f66eee564316c4016 /source4/param | |
parent | 32d56271eb7ebf694c08c226c80fdf97a885fe46 (diff) | |
download | samba-9e84f1e5767c23c0e75a0954ac9c3668d18baa30.tar.gz |
s4/param: treat NULL value passed to dict_insert as error
insert_dict is used as a convenience to decrement the values to
prevent leaks with orpahaned PyObjects and avoid excessive creation of
temp variables.
if (!dict_insert(parameters,
"rootdn",
PyUnicode_FromString(settings->root_dn_str))) {
status = NT_STATUS_UNSUCCESSFUL;
goto out;
}
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/param')
-rw-r--r-- | source4/param/provision.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/source4/param/provision.c b/source4/param/provision.c index 60ce07384f8..5cf38c66dd2 100644 --- a/source4/param/provision.c +++ b/source4/param/provision.c @@ -35,6 +35,9 @@ static bool dict_insert(PyObject* dict, const char* key, PyObject* value) { + if (value == NULL) { + return false; + } if (PyDict_SetItemString(dict, key, value) == -1) { Py_XDECREF(value); return false; |