1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

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>
This commit is contained in:
Noel Power 2020-03-16 15:54:00 +00:00 committed by Andrew Bartlett
parent 32d56271eb
commit 9e84f1e576

View File

@ -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;