From f854209996491b34b7326c956d512f3d77db600e Mon Sep 17 00:00:00 2001 From: Amitay Isaacs Date: Wed, 3 Aug 2011 10:50:31 +1000 Subject: s4-libcli: Fix the fd leak. Close open file descriptor before return. Signed-off-by: Andrew Bartlett Autobuild-User: Andrew Bartlett Autobuild-Date: Wed Aug 3 07:49:12 CEST 2011 on sn-devel-104 --- source4/libcli/pysmb.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source4/libcli/pysmb.c b/source4/libcli/pysmb.c index 91ecc83d01..afa85ab5da 100644 --- a/source4/libcli/pysmb.c +++ b/source4/libcli/pysmb.c @@ -346,10 +346,10 @@ static PyObject *py_smb_getacl(py_talloc_Object *self, PyObject *args, PyObject status = smb_raw_query_secdesc(spdata->tree, self->talloc_ctx, &fio); - PyErr_NTSTATUS_IS_ERR_RAISE(status); - smbcli_close(spdata->tree, fnum); + PyErr_NTSTATUS_IS_ERR_RAISE(status); + return py_return_ndr_struct("samba.dcerpc.security", "descriptor", self->talloc_ctx, fio.query_secdesc.out.sd); } @@ -414,6 +414,8 @@ static PyObject *py_smb_setacl(py_talloc_Object *self, PyObject *args, PyObject fio.set_secdesc.in.sd = sd; status = smb_raw_set_secdesc(spdata->tree, &fio); + smbcli_close(spdata->tree, fnum); + PyErr_NTSTATUS_IS_ERR_RAISE(status); Py_RETURN_NONE; -- cgit