From: Mark Andrews Date: Wed, 5 Feb 2020 05:51:01 +0000 (+1100) Subject: 'dctx' must be non NULL, remove test. X-Git-Tag: v9.16.0~29^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fccf65a5852da5fa399f0720469f77555f49998b;p=thirdparty%2Fbind9.git '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)); --- diff --git a/lib/dns/masterdump.c b/lib/dns/masterdump.c index f3f02d049b0..b5adeb532ef 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); }