smbd: Fix CID 1453984: Null pointer dereferences (REVERSE_INULL)
authorVolker Lendecke <vl@samba.org>
Tue, 24 Sep 2019 16:51:08 +0000 (09:51 -0700)
committerRalph Boehme <slow@samba.org>
Wed, 2 Oct 2019 08:01:40 +0000 (08:01 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/locking/share_mode_lock.c

index abd911f4be2b39e3ec4283d7216517d84089fadb..aeb9fd4b18b3fec6e682aaf2ed5e3df48bc1cdf1 100644 (file)
@@ -2031,9 +2031,7 @@ static void mark_share_mode_disconnected_fn(
 bool mark_share_mode_disconnected(struct share_mode_lock *lck,
                                  struct files_struct *fsp)
 {
-       struct mark_share_mode_disconnected_state state = {
-               .open_persistent_id = fsp->op->global->open_persistent_id,
-       };
+       struct mark_share_mode_disconnected_state state;
        bool ok;
 
        if (lck->data->num_share_modes != 1) {
@@ -2047,6 +2045,10 @@ bool mark_share_mode_disconnected(struct share_mode_lock *lck,
                return false;
        }
 
+       state = (struct mark_share_mode_disconnected_state) {
+               .open_persistent_id = fsp->op->global->open_persistent_id,
+       };
+
        ok = share_mode_entry_do(
                lck,
                messaging_server_id(fsp->conn->sconn->msg_ctx),