From: Stefan Metzmacher Date: Mon, 21 Dec 2020 15:40:01 +0000 (+0100) Subject: s3:smbd: fix the error cleanup in create_file_unixpath() X-Git-Tag: samba-4.14.0rc1~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=87b4a8f35a8ab993eec806022986fdf860c8bbc7;p=thirdparty%2Fsamba.git s3:smbd: fix the error cleanup in create_file_unixpath() We always need to cleanup the base_fsp! Signed-off-by: Stefan Metzmacher --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 8a918e32b7c..67b5925bd51 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -5816,8 +5816,7 @@ static NTSTATUS create_file_unixpath(connection_struct *conn, status = fsp_bind_smb(fsp, req); if (!NT_STATUS_IS_OK(status)) { - file_free(req, fsp); - return status; + goto fail; } if (fsp->base_fsp != NULL) { @@ -5939,8 +5938,11 @@ static NTSTATUS create_file_unixpath(connection_struct *conn, } if (!NT_STATUS_IS_OK(status)) { - file_free(req, fsp); - fsp = NULL; + /* + * We have to reset the already set base_fsp + * in order to close it in the error cleanup + */ + fsp->base_fsp = NULL; goto fail; }