From: Douglas Bagnall Date: Wed, 31 Aug 2022 23:06:03 +0000 (+1200) Subject: pysmbd: avoid leaks in get_nt_acl() X-Git-Tag: talloc-2.4.0~1148 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a5eeed52efa3656fc44ec44874f72790e82c9d91;p=thirdparty%2Fsamba.git pysmbd: avoid leaks in get_nt_acl() BUG: https://bugzilla.samba.org/show_bug.cgi?id=14937 Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/source3/smbd/pysmbd.c b/source3/smbd/pysmbd.c index 658de43d2c0..e7bd8b8f622 100644 --- a/source3/smbd/pysmbd.c +++ b/source3/smbd/pysmbd.c @@ -810,7 +810,9 @@ static PyObject *py_smbd_set_nt_acl(PyObject *self, PyObject *args, PyObject *kw status = set_nt_acl_conn(fname, security_info_sent, sd, conn); TALLOC_FREE(frame); - PyErr_NTSTATUS_IS_ERR_RAISE(status); + if (NT_STATUS_IS_ERR(status)) { + return NULL; + } Py_RETURN_NONE; } @@ -865,6 +867,7 @@ static PyObject *py_smbd_get_nt_acl(PyObject *self, PyObject *args, PyObject *kw "Expected auth_session_info for " "session_info argument got %s", pytalloc_get_name(py_session)); + TALLOC_FREE(frame); return NULL; } @@ -875,7 +878,11 @@ static PyObject *py_smbd_get_nt_acl(PyObject *self, PyObject *args, PyObject *kw } status = get_nt_acl_conn(frame, fname, conn, security_info_wanted, &sd); - PyErr_NTSTATUS_IS_ERR_RAISE(status); + if (NT_STATUS_IS_ERR(status)) { + PyErr_SetNTSTATUS(status); + TALLOC_FREE(frame); + return NULL; + } py_sd = py_return_ndr_struct("samba.dcerpc.security", "descriptor", sd, sd);