s3:smbd: Fix a possible null pointer deref in oplock code
authorAndreas Schneider <asn@samba.org>
Tue, 24 Nov 2020 15:57:12 +0000 (16:57 +0100)
committerStefan Metzmacher <metze@samba.org>
Thu, 26 Nov 2020 06:52:41 +0000 (06:52 +0000)
Found by cppcheck.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/smbd/oplock.c

index b6ac60fa4e14feec1efe1b9686b62a6760a3b736..d4062f7a66cdb64556c68a46c1f25a449d14886d 100644 (file)
@@ -433,12 +433,11 @@ static void downgrade_lease_additional_trigger(struct tevent_context *ev,
                                            &state->lease_key,
                                            state->break_from,
                                            state->break_to);
-       TALLOC_FREE(state);
        if (!NT_STATUS_IS_OK(status)) {
                smbd_server_disconnect_client(state->client,
                                              nt_errstr(status));
-               return;
        }
+       TALLOC_FREE(state);
 }
 
 struct fsps_lease_update_state {