]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
pysmbd: avoid leaks in get_nt_acl()
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Wed, 31 Aug 2022 23:06:03 +0000 (11:06 +1200)
committerDouglas Bagnall <dbagnall@samba.org>
Wed, 7 Sep 2022 05:01:37 +0000 (05:01 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14937

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/smbd/pysmbd.c

index 658de43d2c01771c9336eeda9e210485be950c04..e7bd8b8f622d13ed42eef5370c1856ea3abc9356 100644 (file)
@@ -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);