From fccf65a5852da5fa399f0720469f77555f49998b Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 5 Feb 2020 16:51:01 +1100 Subject: [PATCH] 'dctx' must be non NULL, remove test. 1549 cleanup: 1550 if (dctx->dbiter != NULL) 1551 dns_dbiterator_destroy(&dctx->dbiter); 1552 if (dctx->db != NULL) 1553 dns_db_detach(&dctx->db); CID 1452686 (#1 of 1): Dereference before null check (REVERSE_INULL) check_after_deref: Null-checking dctx suggests that it may be null, but it has already been dereferenced on all paths leading to the check. 1554 if (dctx != NULL) 1555 isc_mem_put(mctx, dctx, sizeof(*dctx)); --- lib/dns/masterdump.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/dns/masterdump.c b/lib/dns/masterdump.c index f3f02d049b..b5adeb532e 100644 --- a/lib/dns/masterdump.c +++ b/lib/dns/masterdump.c @@ -1547,12 +1547,13 @@ dumpctx_create(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version, return (ISC_R_SUCCESS); cleanup: - if (dctx->dbiter != NULL) + if (dctx->dbiter != NULL) { dns_dbiterator_destroy(&dctx->dbiter); - if (dctx->db != NULL) + } + if (dctx->db != NULL) { dns_db_detach(&dctx->db); - if (dctx != NULL) - isc_mem_put(mctx, dctx, sizeof(*dctx)); + } + isc_mem_put(mctx, dctx, sizeof(*dctx)); return (result); }