]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4/libcli/ldab: clang: Fix 'Access results in a deref of a null pointer'
authorNoel Power <noel.power@suse.com>
Wed, 10 Jul 2019 15:13:38 +0000 (16:13 +0100)
committerGary Lockyer <gary@samba.org>
Tue, 16 Jul 2019 22:52:24 +0000 (22:52 +0000)
Fixes:

source4/libcli/ldap/ldap_client.c:1023:6: warning: Access to field 'type' results in a dereference of a null pointer <--[clang]
        if ((*msg)->type != type) {
            ^~~~~~~~~~~~

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
source4/libcli/ldap/ldap_client.c

index da84adc77691e6f75e6d5079971c7fc012337590..a5defbcb4e3f6853f15a95e9ced92e0c7ecc2715 100644 (file)
@@ -1020,7 +1020,7 @@ _PUBLIC_ NTSTATUS ldap_result_one(struct ldap_request *req, struct ldap_message
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
-       if ((*msg)->type != type) {
+       if ((*msg) != NULL && (*msg)->type != type) {
                *msg = NULL;
                return NT_STATUS_UNEXPECTED_NETWORK_ERROR;
        }