mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 05:57:52 +00:00
Merge branch 'marka-coverity-master' into 'master'
Address various minor issues identified by coverity on master See merge request isc-projects/bind9!2999
This commit is contained in:
commit
dd6598f391
@ -10065,8 +10065,7 @@ named_add_reserved_dispatch(named_server_t *server,
|
||||
return;
|
||||
|
||||
cleanup:
|
||||
if (dispatch != NULL)
|
||||
isc_mem_put(server->mctx, dispatch, sizeof(*dispatch));
|
||||
isc_mem_put(server->mctx, dispatch, sizeof(*dispatch));
|
||||
isc_sockaddr_format(addr, addrbuf, sizeof(addrbuf));
|
||||
isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL,
|
||||
NAMED_LOGMODULE_SERVER, ISC_LOG_WARNING,
|
||||
@ -11028,8 +11027,7 @@ named_server_dumpdb(named_server_t *server, isc_lex_t *lex,
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
cleanup:
|
||||
if (dctx != NULL)
|
||||
dumpcontext_destroy(dctx);
|
||||
dumpcontext_destroy(dctx);
|
||||
return (result);
|
||||
}
|
||||
|
||||
@ -13835,10 +13833,6 @@ named_server_delzone(named_server_t *server, isc_lex_t *lex,
|
||||
dns_zone_detach(&raw);
|
||||
if (zone != NULL)
|
||||
dns_zone_detach(&zone);
|
||||
if (dz != NULL) {
|
||||
dns_zone_detach(&dz->zone);
|
||||
isc_mem_put(named_g_mctx, dz, sizeof(*dz));
|
||||
}
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
@ -120,8 +120,7 @@ dyndb_init(isc_mem_t *mctx, const char *name, const char *parameters,
|
||||
*instp = sample_inst;
|
||||
|
||||
cleanup:
|
||||
if (s != NULL)
|
||||
isc_mem_free(mctx, s);
|
||||
isc_mem_free(mctx, s);
|
||||
if (argv != NULL)
|
||||
isc_mem_put(mctx, argv, argc * sizeof(*argv));
|
||||
|
||||
|
@ -157,7 +157,7 @@ is_safe(const char *input) {
|
||||
return (true);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
static void
|
||||
create_path_helper(char *out, const char *in, config_data_t *cd) {
|
||||
char *tmpString;
|
||||
char *tmpPtr;
|
||||
@ -206,7 +206,6 @@ create_path_helper(char *out, const char *in, config_data_t *cd) {
|
||||
}
|
||||
|
||||
isc_mem_free(named_g_mctx, tmpString);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
/*%
|
||||
@ -223,7 +222,6 @@ create_path(const char *zone, const char *host, const char *client,
|
||||
char *tmpPath;
|
||||
int pathsize;
|
||||
int len;
|
||||
isc_result_t result;
|
||||
bool isroot = false;
|
||||
|
||||
/* we require a zone & cd parameter */
|
||||
@ -285,9 +283,7 @@ create_path(const char *zone, const char *host, const char *client,
|
||||
|
||||
/* add zone name - parsed properly */
|
||||
if (!isroot) {
|
||||
result = create_path_helper(tmpPath, zone, cd);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto cleanup_mem;
|
||||
create_path_helper(tmpPath, zone, cd);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -322,26 +318,13 @@ create_path(const char *zone, const char *host, const char *client,
|
||||
/* if host not null, add it. */
|
||||
if (host != NULL) {
|
||||
strncat(tmpPath, (char *) &cd->pathsep, 1);
|
||||
if ((result = create_path_helper(tmpPath, host,
|
||||
cd)) != ISC_R_SUCCESS)
|
||||
goto cleanup_mem;
|
||||
create_path_helper(tmpPath, host, cd);
|
||||
}
|
||||
|
||||
/* return the path we built. */
|
||||
*path = tmpPath;
|
||||
|
||||
/* return success */
|
||||
result = ISC_R_SUCCESS;
|
||||
|
||||
cleanup_mem:
|
||||
/* cleanup memory */
|
||||
|
||||
/* free tmpPath memory */
|
||||
if (tmpPath != NULL && result != ISC_R_SUCCESS)
|
||||
isc_mem_free(named_g_mctx, tmpPath);
|
||||
|
||||
/* free tmpPath memory */
|
||||
return (result);
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@ -705,19 +688,18 @@ fs_allnodes(const char *zone, void *driverarg, void *dbdata,
|
||||
} /* end while */
|
||||
|
||||
complete_allnds:
|
||||
if (dir_list != NULL) {
|
||||
/* clean up entries from list. */
|
||||
dir_entry = ISC_LIST_HEAD(*dir_list);
|
||||
while (dir_entry != NULL) {
|
||||
next_de = ISC_LIST_NEXT(dir_entry, link);
|
||||
isc_mem_put(named_g_mctx, dir_entry, sizeof(dir_entry_t));
|
||||
dir_entry = next_de;
|
||||
} /* end while */
|
||||
isc_mem_put(named_g_mctx, dir_list, sizeof(dlist_t));
|
||||
}
|
||||
/* clean up entries from list. */
|
||||
dir_entry = ISC_LIST_HEAD(*dir_list);
|
||||
while (dir_entry != NULL) {
|
||||
next_de = ISC_LIST_NEXT(dir_entry, link);
|
||||
isc_mem_put(named_g_mctx, dir_entry, sizeof(dir_entry_t));
|
||||
dir_entry = next_de;
|
||||
} /* end while */
|
||||
isc_mem_put(named_g_mctx, dir_list, sizeof(dlist_t));
|
||||
|
||||
if (basepath != NULL)
|
||||
if (basepath != NULL) {
|
||||
isc_mem_free(named_g_mctx, basepath);
|
||||
}
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
@ -254,8 +254,7 @@ build_querylist(isc_mem_t *mctx, const char *query_str, char **zone,
|
||||
|
||||
flag_fail:
|
||||
/* get rid of what was build of the query list */
|
||||
if (tql != NULL)
|
||||
destroy_querylist(mctx, &tql);
|
||||
destroy_querylist(mctx, &tql);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1655,9 +1655,7 @@ dns_catz_generate_zonecfg(dns_catz_zone_t *zone, dns_catz_entry_t *entry,
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
cleanup:
|
||||
if (buffer != NULL) {
|
||||
isc_buffer_free(&buffer);
|
||||
}
|
||||
isc_buffer_free(&buffer);
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
@ -1393,8 +1393,7 @@ dns_client_startresolve(dns_client_t *client, const dns_name_t *name,
|
||||
isc_mutex_destroy(&rctx->lock);
|
||||
isc_mem_put(mctx, rctx, sizeof(*rctx));
|
||||
}
|
||||
if (event != NULL)
|
||||
isc_event_free(ISC_EVENT_PTR(&event));
|
||||
isc_event_free(ISC_EVENT_PTR(&event));
|
||||
isc_task_detach(&tclone);
|
||||
dns_view_detach(&view);
|
||||
|
||||
@ -1489,7 +1488,6 @@ dns_client_addtrustedkey(dns_client_t *client, dns_rdataclass_t rdclass,
|
||||
{
|
||||
isc_result_t result;
|
||||
dns_view_t *view = NULL;
|
||||
dst_key_t *dstkey = NULL;
|
||||
dns_keytable_t *secroots = NULL;
|
||||
dns_name_t *name = NULL;
|
||||
char dsbuf[DNS_DS_BUFFERSIZE];
|
||||
@ -1534,9 +1532,6 @@ dns_client_addtrustedkey(dns_client_t *client, dns_rdataclass_t rdclass,
|
||||
CHECK(dns_keytable_add(secroots, false, false, name, &ds));
|
||||
|
||||
cleanup:
|
||||
if (dstkey != NULL) {
|
||||
dst_key_free(&dstkey);
|
||||
}
|
||||
if (view != NULL) {
|
||||
dns_view_detach(&view);
|
||||
}
|
||||
|
@ -126,26 +126,6 @@ dns_ipkeylist_copy(isc_mem_t *mctx, const dns_ipkeylist_t *src,
|
||||
}
|
||||
dst->count = src->count;
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
do {
|
||||
if (dst->labels[i] != NULL) {
|
||||
if (dns_name_dynamic(dst->labels[i]))
|
||||
dns_name_free(dst->labels[i], mctx);
|
||||
isc_mem_put(mctx, dst->labels[i], sizeof(dns_name_t));
|
||||
dst->labels[i] = NULL;
|
||||
}
|
||||
} while (i-- > 0);
|
||||
|
||||
do {
|
||||
if (dst->keys[i] != NULL) {
|
||||
if (dns_name_dynamic(dst->keys[i]))
|
||||
dns_name_free(dst->keys[i], mctx);
|
||||
isc_mem_put(mctx, dst->keys[i], sizeof(dns_name_t));
|
||||
dst->keys[i] = NULL;
|
||||
}
|
||||
} while (i-- > 0);
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
|
@ -89,7 +89,7 @@ keymgr_keyrole(dst_key_t* key)
|
||||
return ("CSK");
|
||||
} else if (ksk) {
|
||||
return ("KSK");
|
||||
} else {
|
||||
} else if (zsk) {
|
||||
return ("ZSK");
|
||||
}
|
||||
return ("NOSIGN");
|
||||
|
@ -400,7 +400,7 @@ totext_ctx_init(const dns_master_style_t *style, const dns_indent_t *indentctx,
|
||||
ctx->current_ttl = 0;
|
||||
ctx->current_ttl_valid = false;
|
||||
ctx->serve_stale_ttl = 0;
|
||||
ctx->indent = indentctx ? *indentctx : default_indent;
|
||||
ctx->indent = *indentctx;
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
@ -6368,8 +6368,7 @@ addnoqname(dns_rbtdb_t *rbtdb, rdatasetheader_t *newheader,
|
||||
cleanup:
|
||||
dns_rdataset_disassociate(&neg);
|
||||
dns_rdataset_disassociate(&negsig);
|
||||
if (noqname != NULL)
|
||||
free_noqname(mctx, &noqname);
|
||||
free_noqname(mctx, &noqname);
|
||||
return(result);
|
||||
}
|
||||
|
||||
@ -6413,8 +6412,7 @@ addclosest(dns_rbtdb_t *rbtdb, rdatasetheader_t *newheader,
|
||||
cleanup:
|
||||
dns_rdataset_disassociate(&neg);
|
||||
dns_rdataset_disassociate(&negsig);
|
||||
if (closest != NULL)
|
||||
free_noqname(mctx, &closest);
|
||||
free_noqname(mctx, &closest);
|
||||
return(result);
|
||||
}
|
||||
|
||||
|
@ -13428,17 +13428,18 @@ ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset, dns_stub_t *stub) {
|
||||
|
||||
cleanup:
|
||||
cancel_refresh(zone);
|
||||
if (stub != NULL) {
|
||||
stub->magic = 0;
|
||||
if (stub->version != NULL)
|
||||
dns_db_closeversion(stub->db, &stub->version,
|
||||
false);
|
||||
if (stub->db != NULL)
|
||||
dns_db_detach(&stub->db);
|
||||
if (stub->zone != NULL)
|
||||
zone_idetach(&stub->zone);
|
||||
isc_mem_put(stub->mctx, stub, sizeof(*stub));
|
||||
stub->magic = 0;
|
||||
if (stub->version != NULL) {
|
||||
dns_db_closeversion(stub->db, &stub->version,
|
||||
false);
|
||||
}
|
||||
if (stub->db != NULL) {
|
||||
dns_db_detach(&stub->db);
|
||||
}
|
||||
if (stub->zone != NULL) {
|
||||
zone_idetach(&stub->zone);
|
||||
}
|
||||
isc_mem_put(stub->mctx, stub, sizeof(*stub));
|
||||
if (message != NULL)
|
||||
dns_message_destroy(&message);
|
||||
unlock:
|
||||
|
@ -321,17 +321,15 @@ isc_logconfig_create(isc_log_t *lctx, isc_logconfig_t **lcfgp) {
|
||||
|
||||
lcfg = isc_mem_get(lctx->mctx, sizeof(*lcfg));
|
||||
|
||||
{
|
||||
lcfg->lctx = lctx;
|
||||
lcfg->channellists = NULL;
|
||||
lcfg->channellist_count = 0;
|
||||
lcfg->duplicate_interval = 0;
|
||||
lcfg->highest_level = level;
|
||||
lcfg->tag = NULL;
|
||||
lcfg->dynamic = false;
|
||||
ISC_LIST_INIT(lcfg->channels);
|
||||
lcfg->magic = LCFG_MAGIC;
|
||||
}
|
||||
lcfg->lctx = lctx;
|
||||
lcfg->channellists = NULL;
|
||||
lcfg->channellist_count = 0;
|
||||
lcfg->duplicate_interval = 0;
|
||||
lcfg->highest_level = level;
|
||||
lcfg->tag = NULL;
|
||||
lcfg->dynamic = false;
|
||||
ISC_LIST_INIT(lcfg->channels);
|
||||
lcfg->magic = LCFG_MAGIC;
|
||||
|
||||
/*
|
||||
* Create the default channels:
|
||||
@ -377,18 +375,18 @@ isc_logconfig_create(isc_log_t *lctx, isc_logconfig_t **lcfgp) {
|
||||
ISC_LOG_PRINTTIME);
|
||||
}
|
||||
|
||||
if (result == ISC_R_SUCCESS)
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
result = isc_log_createchannel(lcfg, "null",
|
||||
ISC_LOG_TONULL,
|
||||
ISC_LOG_DYNAMIC,
|
||||
NULL, 0);
|
||||
}
|
||||
|
||||
if (result == ISC_R_SUCCESS)
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
*lcfgp = lcfg;
|
||||
|
||||
else
|
||||
if (lcfg != NULL)
|
||||
isc_logconfig_destroy(&lcfg);
|
||||
} else {
|
||||
isc_logconfig_destroy(&lcfg);
|
||||
}
|
||||
|
||||
return (result);
|
||||
}
|
||||
|
@ -956,8 +956,8 @@ isc__nmsocket_init(isc_nmsocket_t *sock, isc_nm_t *mgr,
|
||||
} else {
|
||||
sock->statsindex = tcp6statsindex;
|
||||
}
|
||||
break;
|
||||
isc__nm_incstats(sock->mgr, sock->statsindex[STATID_ACTIVE]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user