]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:smbd: fix the error cleanup in create_file_unixpath()
authorStefan Metzmacher <metze@samba.org>
Mon, 21 Dec 2020 15:40:01 +0000 (16:40 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 14 Jan 2021 11:30:38 +0000 (11:30 +0000)
We always need to cleanup the base_fsp!

Signed-off-by: Stefan Metzmacher <metze@samba.org>
source3/smbd/open.c

index 8a918e32b7cb591cc565a80aefdc063212f9bffe..67b5925bd515b1ba8194c2669ea606cb0ddfc809 100644 (file)
@@ -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;
        }