s3:smbd: Implementation of SMB2.1 and SMB3.0 leases.
[obnox/samba/samba-obnox.git] / source3 / smbd / files.c
index 91eddb879b2a8aa7adf488570926bb8915c550c3..1ad601abcdbf158d589c010f95da183f8cb634d5 100644 (file)
@@ -490,6 +490,14 @@ void fsp_free(files_struct *fsp)
                fsp->fh->ref_count--;
        }
 
+       if (fsp->lease != NULL) {
+               if (fsp->lease->ref_count == 1) {
+                       TALLOC_FREE(fsp->lease);
+               } else {
+                       fsp->lease->ref_count--;
+               }
+       }
+
        fsp->conn->num_files_open--;
 
        /* this is paranoia, just in case someone tries to reuse the