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,
This commit is contained in:
Mark Andrews
2023-08-28 16:25:16 +10:00
parent 62fb970d0a
commit 60630fe3aa

View File

@@ -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);
}