From: Francois-Xavier Le Bail Date: Tue, 8 Mar 2022 09:28:35 +0000 (+0100) Subject: Fix two invalid tests X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/7c4064c6d17068bb0eb63647d4762ad7fb56e203 Fix two invalid tests 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) { ^ --- diff --git a/addrtoname.c b/addrtoname.c index 33ae2752..914665c2 100644 --- a/addrtoname.c +++ b/addrtoname.c @@ -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)