]> 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 12:42:12 +0000 (13:42 +0100)
commit47c206f386845bfd40c03aa8d889e91d277200e3
treecd871d1e70ac5d8b0445215e78cd6e873e1f7b0c
parent5055fc73851ae0e93af393d02477dd2dfd638045
Silence cppcheck 2.2 false positive in udp_recv()

cppcheck 2.2 reports the following false positive:

    lib/dns/dispatch.c:1220: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:1191:11: note: Assuming that condition 'resp==NULL' is not redundant
     if (resp == NULL) {
              ^
    lib/dns/dispatch.c:1220:14: note: Null pointer dereference
     if (disp != resp->disp) {
                 ^

Apparently this version of cppcheck gets confused about conditional
"goto" statements because line 1220 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.

(cherry picked from commit 0b6216d1c702ef0aaa66a2a1bea70cfb12c81468)
lib/dns/dispatch.c