smbd: check for conn->cwd_fsp in file_free()
authorRalph Boehme <slow@samba.org>
Sat, 13 Jun 2020 14:21:22 +0000 (16:21 +0200)
committerJeremy Allison <jra@samba.org>
Sat, 18 Jul 2020 05:58:41 +0000 (05:58 +0000)
This avoids doing the check in all callers.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/files.c

index 1a59db7d1e1dc49206d1c1518c79625e1e3717cc..8bba6c550b37ce399b9b08b19b22a2e54a59ec2e 100644 (file)
@@ -591,6 +591,10 @@ void file_free(struct smb_request *req, files_struct *fsp)
        struct smbd_server_connection *sconn = fsp->conn->sconn;
        uint64_t fnum = fsp->fnum;
 
+       if (fsp == fsp->conn->cwd_fsp) {
+               return;
+       }
+
        if (fsp->notify) {
                size_t len = fsp_fullbasepath(fsp, NULL, 0);
                char fullpath[len+1];