]> git.ipfire.org Git - thirdparty/bind9.git/commit
Silence cppcheck 2.2 false positive in udp_recv()
authorMichał Kępień <michal@isc.org>
Wed, 25 Nov 2020 11:45:47 +0000 (12:45 +0100)
committerMichał Kępień <michal@isc.org>
Wed, 25 Nov 2020 11:45:47 +0000 (12:45 +0100)
commit0b6216d1c702ef0aaa66a2a1bea70cfb12c81468
treeb61e6a43cb242e22fee36b15431292e208688799
parentd9701e22b5b98fbc9915c319eb364a56652979bc
Silence cppcheck 2.2 false positive in udp_recv()

cppcheck 2.2 reports the following false positive:

    lib/dns/dispatch.c:1239:14: warning: Either the condition 'resp==NULL' is redundant or there is possible null pointer dereference: resp. [nullPointerRedundantCheck]
     if (disp != resp->disp) {
                 ^
    lib/dns/dispatch.c:1210:11: note: Assuming that condition 'resp==NULL' is not redundant
     if (resp == NULL) {
              ^
    lib/dns/dispatch.c:1239:14: note: Null pointer dereference
     if (disp != resp->disp) {
                 ^

Apparently this version of cppcheck gets confused about conditional
"goto" statements because line 1239 can never be reached if 'resp' is
NULL.

Move a code block to prevent the above false positive from being
reported without affecting the processing logic.
lib/dns/dispatch.c