1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-11 16:58:40 +03:00

s3:pysmbd: fix fd leak in py_smbd_create_file()

Various 'samba-tool domain backup' commands use this and will
fail if there's over ~1000 files in the sysvol folder.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13898

Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit d8fa464a2dfb11df4e1db4ebffe8bd28ff118c75)
This commit is contained in:
Stefan Metzmacher 2021-02-09 13:48:36 +01:00 committed by Karolin Seeger
parent e80ef35f93
commit 6382ca8568

View File

@ -1113,9 +1113,12 @@ static PyObject *py_smbd_create_file(PyObject *self, PyObject *args, PyObject *k
if (!NT_STATUS_IS_OK(status)) { if (!NT_STATUS_IS_OK(status)) {
DBG_ERR("init_files_struct failed: %s\n", DBG_ERR("init_files_struct failed: %s\n",
nt_errstr(status)); nt_errstr(status));
} else if (fsp != NULL) {
SMB_VFS_CLOSE(fsp);
} }
TALLOC_FREE(frame); TALLOC_FREE(frame);
PyErr_NTSTATUS_NOT_OK_RAISE(status);
Py_RETURN_NONE; Py_RETURN_NONE;
} }