From 8e5a7e8bac898cf94cdfbf39cbf6aed24a1d6fe5 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Mon, 18 Jul 2022 17:21:25 +1000 Subject: [PATCH] Silence REVERSE_INULL Remove unnecessary != NULL checks *** CID 352809: Null pointer dereferences (REVERSE_INULL) /lib/dns/message.c: 4654 in dns_message_buildopt() 4648 if (rdata != NULL) { 4649 dns_message_puttemprdata(message, &rdata); 4650 } 4651 if (rdataset != NULL) { 4652 dns_message_puttemprdataset(message, &rdataset); 4653 } >>> CID 352809: Null pointer dereferences (REVERSE_INULL) >>> Null-checking "rdatalist" suggests that it may be null, but it has already been dereferenced on all paths leading to the check. 4654 if (rdatalist != NULL) { 4655 dns_message_puttemprdatalist(message, &rdatalist); 4656 } 4657 return (result); 4658 } 4659 --- lib/dns/message.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/dns/message.c b/lib/dns/message.c index 3cbe3fa9b0..fc17d9f079 100644 --- a/lib/dns/message.c +++ b/lib/dns/message.c @@ -4617,15 +4617,9 @@ dns_message_buildopt(dns_message_t *message, dns_rdataset_t **rdatasetp, return (ISC_R_SUCCESS); cleanup: - if (rdata != NULL) { - dns_message_puttemprdata(message, &rdata); - } - if (rdataset != NULL) { - dns_message_puttemprdataset(message, &rdataset); - } - if (rdatalist != NULL) { - dns_message_puttemprdatalist(message, &rdatalist); - } + dns_message_puttemprdata(message, &rdata); + dns_message_puttemprdataset(message, &rdataset); + dns_message_puttemprdatalist(message, &rdatalist); return (result); }