From 60630fe3aaa61daa27e08015f6aea80441ca5f50 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Mon, 28 Aug 2023 16:25:16 +1000 Subject: [PATCH] Silence CID 464884 (REVERSE_INULL) *** CID 464884: Null pointer dereferences (REVERSE_INULL) /bin/tests/system/dyndb/driver/db.c: 644 in create_db() 638 639 *dbp = (dns_db_t *)sampledb; 640 641 return (ISC_R_SUCCESS); 642 643 cleanup: CID 464884: Null pointer dereferences (REVERSE_INULL) Null-checking "sampledb" suggests that it may be null, but it has already been dereferenced on all paths leading to the check. 644 if (sampledb != NULL) { 645 if (dns_name_dynamic(&sampledb->common.origin)) { 646 dns_name_free(&sampledb->common.origin, mctx); 647 } 648 649 isc_mem_putanddetach(&sampledb->common.mctx, sampledb, --- bin/tests/system/dyndb/driver/db.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/bin/tests/system/dyndb/driver/db.c b/bin/tests/system/dyndb/driver/db.c index cadd3d02c2..12293942f3 100644 --- a/bin/tests/system/dyndb/driver/db.c +++ b/bin/tests/system/dyndb/driver/db.c @@ -641,14 +641,12 @@ create_db(isc_mem_t *mctx, const dns_name_t *origin, dns_dbtype_t type, return (ISC_R_SUCCESS); cleanup: - if (sampledb != NULL) { - if (dns_name_dynamic(&sampledb->common.origin)) { - dns_name_free(&sampledb->common.origin, mctx); - } - - isc_mem_putanddetach(&sampledb->common.mctx, sampledb, - sizeof(*sampledb)); + if (dns_name_dynamic(&sampledb->common.origin)) { + dns_name_free(&sampledb->common.origin, mctx); } + isc_mem_putanddetach(&sampledb->common.mctx, sampledb, + sizeof(*sampledb)); + return (result); }