Fix 'Dereference of null pointer' from scan-build-10

These are mostly false positives, the clang-analyzer FAQ[1] specifies
why and how to fix it:

> The reason the analyzer often thinks that a pointer can be null is
> because the preceding code checked compared it against null. So if you
> are absolutely sure that it cannot be null, remove the preceding check
> and, preferably, add an assertion as well.

The 4 warnings reported are:

dnssec-cds.c:781:4: warning: Access to field 'base' results in a dereference of a null pointer (loaded from variable 'buf')
                        isc_buffer_availableregion(buf, &r);
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/builds/isc-projects/bind9/lib/isc/include/isc/buffer.h:996:36: note: expanded from macro 'isc_buffer_availableregion'
                                   ^
/builds/isc-projects/bind9/lib/isc/include/isc/buffer.h:821:16: note: expanded from macro 'ISC__BUFFER_AVAILABLEREGION'
                (_r)->base = isc_buffer_used(_b);              \
                             ^~~~~~~~~~~~~~~~~~~
/builds/isc-projects/bind9/lib/isc/include/isc/buffer.h:152:29: note: expanded from macro 'isc_buffer_used'
        ((void *)((unsigned char *)(b)->base + (b)->used)) /*d*/
                                   ^~~~~~~~~
1 warning generated.

--

byname_test.c:308:34: warning: Access to field 'fwdtable' results in a dereference of a null pointer (loaded from variable 'view')
                RUNTIME_CHECK(dns_fwdtable_add(view->fwdtable, dns_rootname,
                                               ^~~~~~~~~~~~~~
/builds/isc-projects/bind9/lib/isc/include/isc/util.h:318:52: note: expanded from macro 'RUNTIME_CHECK'
                                                   ^~~~
/builds/isc-projects/bind9/lib/isc/include/isc/error.h:50:21: note: expanded from macro 'ISC_ERROR_RUNTIMECHECK'
        ((void)(ISC_LIKELY(cond) ||  \
                           ^~~~
/builds/isc-projects/bind9/lib/isc/include/isc/likely.h:23:43: note: expanded from macro 'ISC_LIKELY'
                                            ^
1 warning generated.

--

./rndc.c:255:6: warning: Dereference of null pointer (loaded from variable 'host')
        if (*host == '/') {
            ^~~~~
1 warning generated.

--

./main.c:1254:9: warning: Access to field 'sctx' results in a dereference of a null pointer (loaded from variable 'named_g_server')
        sctx = named_g_server->sctx;
               ^~~~~~~~~~~~~~~~~~~~
1 warning generated.

References:
1. https://clang-analyzer.llvm.org/faq.html#null_pointer

(cherry picked from commit ddd0d356)
76 jobs for !3286 with ondrej/scan-build-10-fixes-v9_16 in 4 minutes and 4 seconds (queued for 5 seconds)
detached
Status Job ID Name Coverage
  Precheck
canceled #783189
amd64 linux
🐞:sid:amd64

00:04:00

failed #783188
amd64 linux
💾:sid:amd64

00:00:15

passed #783186
amd64 linux
autoreconf:sid:amd64

00:00:35

passed #783187
amd64 linux
misc:sid:amd64

00:00:25

 
  Build
canceled #783204
amd64 linux
asan:sid:amd64

00:00:03

canceled #783211
amd64 libvirt
clang:freebsd11.3:amd64

00:00:04

canceled #783212
amd64 libvirt
clang:freebsd12.1:amd64

canceled #783213
amd64 libvirt
clang:openbsd6.6:amd64

canceled #783208
amd64 linux
clang:stretch:amd64

00:00:02

canceled #783209
i386 linux
clang:stretch:i386

00:00:02

canceled #783190
amd64 linux
gcc:alpine3.11:amd64

00:01:38

canceled #783203
amd64 linux
gcc:bionic:amd64

00:00:03

canceled #783195
amd64 linux
gcc:buster:amd64

00:01:13

canceled #783191
amd64 linux
gcc:centos6:amd64

00:01:37

canceled #783192
amd64 linux
gcc:centos7:amd64

00:01:35

canceled #783193
amd64 linux
gcc:centos8:amd64

00:01:29

canceled #783201
amd64 linux
gcc:fedora31:amd64

00:00:05

canceled #783196
amd64 linux
gcc:sid:amd64

00:01:02

passed #783198
arm64 linux
gcc:sid:arm64

00:02:46

canceled #783199
i386 linux
gcc:sid:i386

00:00:27

canceled #783194
amd64 linux
gcc:stretch:amd64

00:01:27

canceled #783200
amd64 linux
gcc:tumbleweed:amd64

00:00:05

canceled #783202
amd64 linux
gcc:xenial:amd64

00:00:04

passed #783215
amd64 windows
msvc:windows:amd64

00:02:41

canceled #783207
amd64 linux
mutexatomics:sid:amd64

00:00:02

canceled #783214
amd64 linux
nolibtool:sid:amd64

canceled #783197
amd64 linux
oot:sid:amd64

00:00:41

canceled #783210
amd64 linux
pkcs11:sid:amd64

00:00:01

canceled #783206
amd64 linux
rwlock:sid:amd64

00:00:03

canceled #783205
amd64 linux
tsan:buster:amd64

00:00:03

 
  Unit
canceled #783229
amd64 linux
unit:asan:sid:amd64

canceled #783235
amd64 libvirt
unit:clang:freebsd11.3:amd64

canceled #783236
amd64 libvirt
unit:clang:freebsd12.1:amd64

canceled #783233
amd64 linux
unit:clang:stretch:amd64

canceled #783216
amd64 linux
unit:gcc:alpine3.11:amd64

canceled #783228
amd64 linux
unit:gcc:bionic:amd64

canceled #783221
amd64 linux
unit:gcc:buster:amd64

canceled #783217
amd64 linux
unit:gcc:centos6:amd64

canceled #783218
amd64 linux
unit:gcc:centos7:amd64

canceled #783219
amd64 linux
unit:gcc:centos8:amd64

canceled #783226
amd64 linux
unit:gcc:fedora31:amd64

canceled #783222
amd64 linux
unit:gcc:sid:amd64

canceled #783223
arm64 linux
unit:gcc:sid:arm64

00:00:34

canceled #783224
i386 linux
unit:gcc:sid:i386

canceled #783220
amd64 linux
unit:gcc:stretch:amd64

canceled #783225
amd64 linux
unit:gcc:tumbleweed:amd64

canceled #783227
amd64 linux
unit:gcc:xenial:amd64

canceled #783232
amd64 linux
unit:mutexatomics:sid:amd64

canceled #783237
amd64 linux
unit:nolibtool:sid:amd64

canceled #783234
amd64 linux
unit:pkcs11:sid:amd64

canceled #783231
amd64 linux
unit:rwlock:sid:amd64

canceled #783230
amd64 linux allowed to fail
unit:tsan:buster:amd64

 
  System
canceled #783251
amd64 linux
system:asan:sid:amd64

canceled #783256
amd64 libvirt
system:clang:freebsd11.3:amd64

canceled #783257
amd64 libvirt
system:clang:freebsd12.1:amd64

canceled #783238
amd64 linux
system:gcc:alpine3.11:amd64

canceled #783250
amd64 linux
system:gcc:bionic:amd64

canceled #783243
amd64 linux
system:gcc:buster:amd64

canceled #783239
amd64 linux
system:gcc:centos6:amd64

canceled #783240
amd64 linux
system:gcc:centos7:amd64

canceled #783241
amd64 linux
system:gcc:centos8:amd64

canceled #783248
amd64 linux
system:gcc:fedora31:amd64

canceled #783244
amd64 linux
system:gcc:sid:amd64

canceled #783245
arm64 linux
system:gcc:sid:arm64

00:00:34

canceled #783246
i386 linux
system:gcc:sid:i386

canceled #783242
amd64 linux
system:gcc:stretch:amd64

canceled #783247
amd64 linux
system:gcc:tumbleweed:amd64

canceled #783249
amd64 linux
system:gcc:xenial:amd64

canceled #783254
amd64 linux
system:mutexatomics:sid:amd64

canceled #783258
amd64 linux
system:nolibtool:sid:amd64

canceled #783255
amd64 linux
system:pkcs11:sid:amd64

canceled #783253
amd64 linux
system:rwlock:sid:amd64

canceled #783252
amd64 linux allowed to fail
system:tsan:buster:amd64

 
  Docs
canceled #783259
amd64 linux
docs:sid:amd64

 
  Postcheck
canceled #783261
amd64 linux
cppcheck:gcc:sid:amd64

canceled #783260
amd64 linux
scan-build:buster:amd64

 
Name Stage Failure
failed
💾:sid:amd64 Precheck
No job log