libcli/cldap: clang: Fix 'Dereference of null pointer'
authorNoel Power <noel.power@suse.com>
Thu, 11 Jul 2019 11:28:58 +0000 (11:28 +0000)
committerGary Lockyer <gary@samba.org>
Tue, 16 Jul 2019 22:52:24 +0000 (22:52 +0000)
Fixes:

libcli/cldap/cldap.c:144:8: warning: Dereference of null pointer <--[clang]
                ev = c->searches.list->caller.ev;
                     ^
1 warning generated.

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

index daba37a21d710490219664d6559f09b1bbf263d3..f609bf278e4b09610ef79be208d6b8c9bca8cbbd 100644 (file)
@@ -141,6 +141,10 @@ static bool cldap_recvfrom_setup(struct cldap_socket *c)
 
        ev = c->incoming.ev;
        if (ev == NULL) {
+               /* this shouldn't happen but should be protected against */
+               if (c->searches.list == NULL) {
+                       return false;
+               }
                ev = c->searches.list->caller.ev;
        }