From 3584fe46d92037c1fb9825d7d25ecc9bdd60c0f4 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Thu, 3 May 2018 09:39:18 +1200 Subject: [PATCH] s3/py_passdb: maintain correct refcount on allocation failure Signed-off-by: Douglas Bagnall Reviewed-by: Noel Power --- source3/passdb/py_passdb.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source3/passdb/py_passdb.c b/source3/passdb/py_passdb.c index 1b4ec3d531e..2ac2942a47f 100644 --- a/source3/passdb/py_passdb.c +++ b/source3/passdb/py_passdb.c @@ -3945,6 +3945,7 @@ MODULE_INIT_FUNC(passdb) dom_sid_Type = (PyTypeObject *)PyObject_GetAttrString(mod, "dom_sid"); if (dom_sid_Type == NULL) { + Py_DECREF(mod); talloc_free(frame); return NULL; } @@ -3953,6 +3954,7 @@ MODULE_INIT_FUNC(passdb) security_Type = (PyTypeObject *)PyObject_GetAttrString(mod, "descriptor"); Py_DECREF(mod); if (security_Type == NULL) { + Py_DECREF(dom_sid_Type); talloc_free(frame); return NULL; } @@ -3960,6 +3962,8 @@ MODULE_INIT_FUNC(passdb) /* Import GUID type from dcerpc.misc */ mod = PyImport_ImportModule("samba.dcerpc.misc"); if (mod == NULL) { + Py_DECREF(security_Type); + Py_DECREF(dom_sid_Type); talloc_free(frame); return NULL; } @@ -3967,6 +3971,8 @@ MODULE_INIT_FUNC(passdb) guid_Type = (PyTypeObject *)PyObject_GetAttrString(mod, "GUID"); Py_DECREF(mod); if (guid_Type == NULL) { + Py_DECREF(security_Type); + Py_DECREF(dom_sid_Type); talloc_free(frame); return NULL; }