1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

s4/param/provision py_dom_sid_FromSid: avoid python memleak

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>

Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Tue Jan 29 16:54:48 CET 2019 on sn-devel-144
This commit is contained in:
Douglas Bagnall 2018-05-03 09:59:13 +12:00 committed by Noel Power
parent a3aa5af3d5
commit ca93b1e15a

View File

@ -199,13 +199,15 @@ static PyObject *py_dom_sid_FromSid(struct dom_sid *sid)
PyObject *mod_security, *dom_sid_Type;
mod_security = PyImport_ImportModule("samba.dcerpc.security");
if (mod_security == NULL)
if (mod_security == NULL) {
return NULL;
}
dom_sid_Type = PyObject_GetAttrString(mod_security, "dom_sid");
if (dom_sid_Type == NULL)
if (dom_sid_Type == NULL) {
Py_DECREF(mod_security);
return NULL;
}
Py_DECREF(mod_security);
return pytalloc_reference((PyTypeObject *)dom_sid_Type, sid);
}