]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Fix two invalid tests
authorFrancois-Xavier Le Bail <[email protected]>
Tue, 8 Mar 2022 09:28:35 +0000 (10:28 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Tue, 8 Mar 2022 09:30:35 +0000 (10:30 +0100)
Fix these cppcheck warnings:
addrtoname.c:1288:11: warning: Checking if unsigned expression 'num'
is less than zero. [unsignedLessThanZero]
 if (num  <= 0) {
          ^
addrtoname.c:1308:11: warning: Checking if unsigned expression 'num'
is less than zero. [unsignedLessThanZero]
 if (num  <= 0) {
          ^

addrtoname.c

index 33ae275283eacdcf6717b707301812e7376e3195..914665c2315a2d8b8fed7bdf1b6c2a4edb8692ab 100644 (file)
@@ -1285,7 +1285,7 @@ newhnamemem(netdissect_options *ndo)
        static struct hnamemem *ptr = NULL;
        static u_int num = 0;
 
-       if (num  <= 0) {
+       if (num  == 0) {
                num = 64;
                ptr = (struct hnamemem *)calloc(num, sizeof (*ptr));
                if (ptr == NULL)
@@ -1305,7 +1305,7 @@ newh6namemem(netdissect_options *ndo)
        static struct h6namemem *ptr = NULL;
        static u_int num = 0;
 
-       if (num  <= 0) {
+       if (num  == 0) {
                num = 64;
                ptr = (struct h6namemem *)calloc(num, sizeof (*ptr));
                if (ptr == NULL)