From: Noel Power Date: Wed, 10 Jul 2019 15:13:38 +0000 (+0100) Subject: s4/libcli/ldab: clang: Fix 'Access results in a deref of a null pointer' X-Git-Tag: talloc-2.3.0~84 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8aed7e9aae13b3fc64a2af1fbdf835f12038ac9b;p=thirdparty%2Fsamba.git s4/libcli/ldab: clang: Fix 'Access results in a deref of a null pointer' 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 Reviewed-by: Gary Lockyer --- diff --git a/source4/libcli/ldap/ldap_client.c b/source4/libcli/ldap/ldap_client.c index da84adc7769..a5defbcb4e3 100644 --- a/source4/libcli/ldap/ldap_client.c +++ b/source4/libcli/ldap/ldap_client.c @@ -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; }