s3:smbd: make sure openat_pathref_fsp() calls fd_close(fsp->base_fsp);
authorStefan Metzmacher <metze@samba.org>
Mon, 21 Dec 2020 14:31:25 +0000 (15:31 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 14 Jan 2021 11:30:38 +0000 (11:30 +0000)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/files.c

index 122afa4f3d696a39e2d9b0834eff1524e36af466..bb61fd49c9cd7c31757e965fa6dcc04173600d5a 100644 (file)
@@ -479,10 +479,10 @@ NTSTATUS openat_pathref_fsp(const struct files_struct *dirfsp,
                          nt_errstr(status));
 
                if (fsp->base_fsp != NULL) {
+                       fd_close(fsp->base_fsp);
                        file_free(NULL, fsp->base_fsp);
                        fsp->base_fsp = NULL;
                }
-               fd_close(fsp);
                file_free(NULL, fsp);
                fsp = NULL;
 
@@ -547,6 +547,7 @@ fail:
                return status;
        }
        if (fsp->base_fsp != NULL) {
+               fd_close(fsp->base_fsp);
                file_free(NULL, fsp->base_fsp);
                fsp->base_fsp = NULL;
        }