s4-libcli: Fix the fd leak. Close open file descriptor before return.
authorAmitay Isaacs <amitay@gmail.com>
Wed, 3 Aug 2011 00:50:31 +0000 (10:50 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 3 Aug 2011 05:49:12 +0000 (07:49 +0200)
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Wed Aug  3 07:49:12 CEST 2011 on sn-devel-104

source4/libcli/pysmb.c

index 91ecc83d0130ec0e663e8147d8af67b7606510c8..afa85ab5dad4475b9f5ac9ede828faf77383061b 100644 (file)
@@ -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;