]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:locking: let remove_lease_if_stale() use share_mode_lock_file_id()
authorStefan Metzmacher <metze@samba.org>
Fri, 26 Aug 2022 08:43:12 +0000 (10:43 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 20 Sep 2022 00:34:35 +0000 (00:34 +0000)
We should avoid dereference 'struct share_mode_lock' as much as possible.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15125

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/locking/locking.c

index d8367aa7d8c09e229c17f634f555421d88b2578f..4c20ff2c3541e7a549eb3efa77ec16141baf7562 100644 (file)
@@ -721,7 +721,7 @@ NTSTATUS remove_lease_if_stale(struct share_mode_lock *lck,
        struct find_lease_ref_state state = {
                .client_guid = client_guid, .lease_key = lease_key,
        };
-       struct share_mode_data *d = lck->data;
+       struct file_id id = share_mode_lock_file_id(lck);
        NTSTATUS status;
        bool ok;
 
@@ -735,7 +735,7 @@ NTSTATUS remove_lease_if_stale(struct share_mode_lock *lck,
                return NT_STATUS_RESOURCE_IN_USE;
        }
 
-       status = leases_db_del(client_guid, lease_key, &d->id);
+       status = leases_db_del(client_guid, lease_key, &id);
        if (!NT_STATUS_IS_OK(status)) {
                int level = DBGLVL_DEBUG;