From 87b4a8f35a8ab993eec806022986fdf860c8bbc7 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 21 Dec 2020 16:40:01 +0100 Subject: [PATCH] s3:smbd: fix the error cleanup in create_file_unixpath() We always need to cleanup the base_fsp! Signed-off-by: Stefan Metzmacher --- source3/smbd/open.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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; } -- 2.47.2