1940. [bug] Fixed a number of error conditions reported by

Coverity.
This commit is contained in:
Mark Andrews 2005-11-30 03:33:49 +00:00
parent 91be6c5ba2
commit 2674e1a455
42 changed files with 356 additions and 207 deletions

View file

@ -1,3 +1,6 @@
1940. [bug] Fixed a number of error conditions reported by
Coverity.
1939. [bug] The resolver could dereference a null pointer after
validation if all the queries have timed out.
[RT #15528]

View file

@ -16,7 +16,7 @@
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dnssec-signzone.c,v 1.192 2005/10/14 01:14:06 marka Exp $ */
/* $Id: dnssec-signzone.c,v 1.193 2005/11/30 03:33:48 marka Exp $ */
/*! \file */
@ -1271,10 +1271,6 @@ nsecify(void) {
result = dns_dbiterator_next(dbiter);
continue;
}
if (result != ISC_R_SUCCESS) {
dns_db_detachnode(gdb, &nextnode);
break;
}
if (!dns_name_issubdomain(nextname, gorigin) ||
(zonecut != NULL &&
dns_name_issubdomain(nextname, zonecut)))

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: config.c,v 1.61 2005/09/05 02:54:36 marka Exp $ */
/* $Id: config.c,v 1.62 2005/11/30 03:33:48 marka Exp $ */
/*! \file */
@ -448,13 +448,14 @@ ns_config_getipandkeylist(cfg_obj_t *config, cfg_obj_t *list, isc_mem_t *mctx,
if (val > ISC_UINT16_MAX) {
cfg_obj_log(portobj, ns_g_lctx, ISC_LOG_ERROR,
"port '%u' out of range", val);
return (ISC_R_RANGE);
result = ISC_R_RANGE;
goto cleanup;
}
port = (in_port_t) val;
} else {
result = ns_config_getport(config, &port);
if (result != ISC_R_SUCCESS)
return (result);
goto cleanup;
}
result = ISC_R_NOMEMORY;
@ -615,9 +616,9 @@ ns_config_getipandkeylist(cfg_obj_t *config, cfg_obj_t *list, isc_mem_t *mctx,
if (new == NULL)
goto cleanup;
memcpy(new, addrs, newsize);
isc_mem_put(mctx, addrs, oldsize);
} else
new = NULL;
isc_mem_put(mctx, addrs, oldsize);
addrs = new;
addrcount = i;
@ -628,9 +629,9 @@ ns_config_getipandkeylist(cfg_obj_t *config, cfg_obj_t *list, isc_mem_t *mctx,
if (new == NULL)
goto cleanup;
memcpy(new, keys, newsize);
isc_mem_put(mctx, keys, oldsize);
} else
new = NULL;
isc_mem_put(mctx, keys, oldsize);
keys = new;
keycount = i;
}

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: controlconf.c,v 1.45 2005/08/23 02:36:06 marka Exp $ */
/* $Id: controlconf.c,v 1.46 2005/11/30 03:33:48 marka Exp $ */
/*! \file */
@ -364,6 +364,9 @@ control_recvmessage(isc_task_t *task, isc_event_t *event) {
{
ccregion.rstart = isc_buffer_base(&conn->ccmsg.buffer);
ccregion.rend = isc_buffer_used(&conn->ccmsg.buffer);
if (secret.rstart != NULL)
isc_mem_put(listener->mctx, secret.rstart,
REGION_SIZE(secret));
secret.rstart = isc_mem_get(listener->mctx, key->secret.length);
if (secret.rstart == NULL)
goto cleanup;
@ -379,8 +382,6 @@ control_recvmessage(isc_task_t *task, isc_event_t *event) {
*/
if (request != NULL)
isccc_sexpr_free(&request);
isc_mem_put(listener->mctx, secret.rstart,
REGION_SIZE(secret));
} else {
log_invalid(&conn->ccmsg, result);
goto cleanup;
@ -994,11 +995,17 @@ update_listener(ns_controls_t *cp,
* but tracking whether they are identical just for the
* sake of avoiding this message would be too much trouble.
*/
cfg_obj_log(control, ns_g_lctx, ISC_LOG_WARNING,
"couldn't install new keys for "
"command channel %s: %s",
socktext, isc_result_totext(result));
if (control != NULL)
cfg_obj_log(control, ns_g_lctx, ISC_LOG_WARNING,
"couldn't install new keys for "
"command channel %s: %s",
socktext, isc_result_totext(result));
else
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_CONTROL, ISC_LOG_WARNING,
"couldn't install new keys for "
"command channel %s: %s",
socktext, isc_result_totext(result));
/*
* Now, keep the old access list unless a new one can be made.
@ -1016,12 +1023,18 @@ update_listener(ns_controls_t *cp,
dns_acl_detach(&listener->acl);
dns_acl_attach(new_acl, &listener->acl);
dns_acl_detach(&new_acl);
} else
/* XXXDCL say the old acl is still used? */
} else if (control != NULL)
cfg_obj_log(control, ns_g_lctx, ISC_LOG_WARNING,
"couldn't install new acl for "
"command channel %s: %s",
socktext, isc_result_totext(result));
else
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_CONTROL, ISC_LOG_WARNING,
"couldn't install new acl for "
"command channel %s: %s",
socktext, isc_result_totext(result));
if (result == ISC_R_SUCCESS && type == isc_sockettype_unix) {
isc_uint32_t perm, owner, group;
@ -1037,7 +1050,7 @@ update_listener(ns_controls_t *cp,
listener->perm = perm;
listener->owner = owner;
listener->group = group;
} else
} else if (control != NULL)
cfg_obj_log(control, ns_g_lctx, ISC_LOG_WARNING,
"couldn't update ownership/permission for "
"command channel %s", socktext);

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: interfacemgr.c,v 1.82 2005/07/18 05:58:56 marka Exp $ */
/* $Id: interfacemgr.c,v 1.83 2005/11/30 03:33:48 marka Exp $ */
/*! \file */
@ -766,9 +766,8 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen,
* See if the address matches the listen-on statement;
* if not, ignore the interface.
*/
result = dns_acl_match(&listen_netaddr, NULL,
le->acl, &mgr->aclenv,
&match, NULL);
(void)dns_acl_match(&listen_netaddr, NULL, le->acl,
&mgr->aclenv, &match, NULL);
if (match <= 0)
continue;
@ -799,9 +798,9 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen,
for (ele = ISC_LIST_HEAD(ext_listen->elts);
ele != NULL;
ele = ISC_LIST_NEXT(ele, link)) {
dns_acl_match(&listen_netaddr, NULL,
ele->acl, NULL,
&match, NULL);
(void)dns_acl_match(&listen_netaddr,
NULL, ele->acl,
NULL, &match, NULL);
if (match > 0 && ele->port == le->port)
break;
else

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: lwdgrbn.c,v 1.15 2005/04/29 00:22:28 marka Exp $ */
/* $Id: lwdgrbn.c,v 1.16 2005/11/30 03:33:48 marka Exp $ */
/*! \file */
@ -360,7 +360,7 @@ lookup_done(isc_task_t *task, isc_event_t *event) {
client->sendlength = r.length;
result = ns_lwdclient_sendreply(client, &r);
if (result != ISC_R_SUCCESS)
goto out;
goto out2;
NS_LWDCLIENT_SETSEND(client);
@ -380,7 +380,7 @@ lookup_done(isc_task_t *task, isc_event_t *event) {
if (grbn->siglen != NULL)
isc_mem_put(cm->mctx, grbn->siglen,
grbn->nsigs * sizeof(lwres_uint16_t));
out2:
if (client->lookup != NULL)
dns_lookup_destroy(&client->lookup);
if (lwb.base != NULL)

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: lwresd.c,v 1.50 2005/08/23 02:36:07 marka Exp $ */
/* $Id: lwresd.c,v 1.51 2005/11/30 03:33:48 marka Exp $ */
/*! \file
* \brief
@ -408,6 +408,7 @@ ns_lwdmanager_create(isc_mem_t *mctx, cfg_obj_t *lwres,
ns_lwsearchlist_detach(&lwresd->search);
if (lwresd->mctx != NULL)
isc_mem_detach(&lwresd->mctx);
isc_mem_put(mctx, lwresd, sizeof(ns_lwresd_t));
return (result);
}

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: query.c,v 1.275 2005/11/02 01:28:45 marka Exp $ */
/* $Id: query.c,v 1.276 2005/11/30 03:33:48 marka Exp $ */
/*! \file */
@ -3270,7 +3270,9 @@ warn_rfc1918(ns_client_t *client, dns_name_t *fname, dns_rdataset_t *rdataset) {
result = dns_rdataset_first(&found);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
dns_rdataset_current(&found, &rdata);
dns_rdata_tostruct(&rdata, &soa, NULL);
result = dns_rdata_tostruct(&rdata, &soa, NULL);
if (result != ISC_R_SUCCESS)
return;
if (dns_name_equal(&soa.origin, &prisoner) &&
dns_name_equal(&soa.contact, &hostmaster)) {
char buf[DNS_NAME_FORMATSIZE];

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: server.c,v 1.450 2005/09/05 00:10:52 marka Exp $ */
/* $Id: server.c,v 1.451 2005/11/30 03:33:48 marka Exp $ */
/*! \file */
@ -277,7 +277,7 @@ configure_view_acl(cfg_obj_t *vconfig, cfg_obj_t *config,
}
maps[i] = NULL;
result = ns_config_get(maps, aclname, &aclobj);
(void)ns_config_get(maps, aclname, &aclobj);
if (aclobj == NULL)
/*
* No value available. *aclp == NULL.
@ -496,7 +496,6 @@ get_view_querysource_dispatch(cfg_obj_t **maps,
case AF_INET:
result = ns_config_get(maps, "query-source", &obj);
INSIST(result == ISC_R_SUCCESS);
break;
case AF_INET6:
result = ns_config_get(maps, "query-source-v6", &obj);
@ -905,7 +904,7 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
* unless explicitly disabled.
*/
obj = NULL;
ns_config_get(maps, "use-additional-cache", &obj);
(void)ns_config_get(maps, "use-additional-cache", &obj);
if (obj == NULL || cfg_obj_asboolean(obj)) {
cmctx = NULL;
CHECK(isc_mem_create(0, 0, &cmctx));
@ -1282,7 +1281,7 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
* Configure the "match-recursive-only" option.
*/
obj = NULL;
(void) ns_config_get(maps, "match-recursive-only", &obj);
(void)ns_config_get(maps, "match-recursive-only", &obj);
if (obj != NULL && cfg_obj_asboolean(obj))
view->matchrecursiveonly = ISC_TRUE;
else
@ -2249,8 +2248,7 @@ add_listenelt(isc_mem_t *mctx, ns_listenlist_t *list, isc_sockaddr_t *addr) {
clean:
INSIST(lelt == NULL);
if (src_acl != NULL)
dns_acl_detach(&src_acl);
dns_acl_detach(&src_acl);
return (result);
}
@ -4229,6 +4227,11 @@ ns_server_dumpdb(ns_server_t *server, char *args) {
char *ptr;
const char *sep;
/* Skip the command name. */
ptr = next_token(&args, " \t");
if (ptr == NULL)
return (ISC_R_UNEXPECTEDEND);
dctx = isc_mem_get(server->mctx, sizeof(*dctx));
if (dctx == NULL)
return (ISC_R_NOMEMORY);
@ -4251,11 +4254,6 @@ ns_server_dumpdb(ns_server_t *server, char *args) {
CHECKMF(isc_stdio_open(server->dumpfile, "w", &dctx->fp),
"could not open dump file", server->dumpfile);
/* Skip the command name. */
ptr = next_token(&args, " \t");
if (ptr == NULL)
return (ISC_R_UNEXPECTEDEND);
sep = (args == NULL) ? "" : ": ";
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_SERVER, ISC_LOG_INFO,

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zoneconf.c,v 1.124 2005/08/24 23:53:57 marka Exp $ */
/* $Id: zoneconf.c,v 1.125 2005/11/30 03:33:48 marka Exp $ */
/*% */
@ -730,6 +730,7 @@ ns_zone_configure(cfg_obj_t *config, cfg_obj_t *vconfig, cfg_obj_t *zconfig,
switch (ztype) {
case dns_zone_slave:
case dns_zone_stub:
count = 0;
obj = NULL;
result = cfg_map_get(zoptions, "masters", &obj);
if (obj != NULL) {

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: t_db.c,v 1.32 2004/10/25 01:27:54 marka Exp $ */
/* $Id: t_db.c,v 1.33 2005/11/30 03:33:48 marka Exp $ */
#include <config.h>
@ -403,8 +403,10 @@ test_dns_db_zc_x(const char *filename, dns_dbtype_t dbtype,
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
cnt = t_bustline(p, tokens);
if (cnt == 4) {

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dst_test.c,v 1.39 2004/06/11 00:27:05 marka Exp $ */
/* $Id: dst_test.c,v 1.40 2005/11/30 03:33:48 marka Exp $ */
#include <config.h>
@ -236,23 +236,34 @@ main(void) {
isc_buffer_t b;
dns_fixedname_t fname;
dns_name_t *name;
isc_result_t result;
isc_mem_create(0, 0, &mctx);
result = isc_mem_create(0, 0, &mctx);
if (result != ISC_R_SUCCESS)
return (1);
current = isc_mem_get(mctx, 256);
if (current == NULL)
return (1);
getcwd(current, 256);
dns_result_register();
isc_entropy_create(mctx, &ectx);
isc_entropy_createfilesource(ectx, "randomfile");
result = isc_entropy_create(mctx, &ectx);
if (result != ISC_R_SUCCESS)
return (1);
result = isc_entropy_createfilesource(ectx, "randomfile");
if (result != ISC_R_SUCCESS)
return (1);
dst_lib_init(mctx, ectx, ISC_ENTROPY_BLOCKING|ISC_ENTROPY_GOODONLY);
dns_fixedname_init(&fname);
name = dns_fixedname_name(&fname);
isc_buffer_init(&b, "test.", 5);
isc_buffer_add(&b, 5);
dns_name_fromtext(name, &b, NULL, ISC_FALSE, NULL);
result = dns_name_fromtext(name, &b, NULL, ISC_FALSE, NULL);
if (result != ISC_R_SUCCESS)
return (1);
io(name, 23616, DST_ALG_DSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC, mctx);
io(name, 54622, DST_ALG_RSAMD5, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC,
mctx);
@ -262,7 +273,9 @@ main(void) {
isc_buffer_init(&b, "dh.", 3);
isc_buffer_add(&b, 3);
dns_name_fromtext(name, &b, NULL, ISC_FALSE, NULL);
result = dns_name_fromtext(name, &b, NULL, ISC_FALSE, NULL);
if (result != ISC_R_SUCCESS)
return (1);
dh(name, 18602, name, 48957, mctx);
generate(DST_ALG_RSAMD5, mctx);

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: t_dst.c,v 1.49 2004/06/11 00:27:05 marka Exp $ */
/* $Id: t_dst.c,v 1.50 2005/11/30 03:33:48 marka Exp $ */
#include <config.h>
@ -405,7 +405,13 @@ t1(void) {
name = dns_fixedname_name(&fname);
isc_buffer_init(&b, "test.", 5);
isc_buffer_add(&b, 5);
dns_name_fromtext(name, &b, NULL, ISC_FALSE, NULL);
isc_result = dns_name_fromtext(name, &b, NULL, ISC_FALSE, NULL);
if (isc_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
isc_result_totext(isc_result));
t_result(T_UNRESOLVED);
return;
}
io(name, 23616, DST_ALG_DSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC,
mctx, ISC_R_SUCCESS, &nfails, &nprobs);
t_info("testing use of stored keys [2]\n");
@ -421,7 +427,13 @@ t1(void) {
isc_buffer_init(&b, "dh.", 3);
isc_buffer_add(&b, 3);
dns_name_fromtext(name, &b, NULL, ISC_FALSE, NULL);
isc_result = dns_name_fromtext(name, &b, NULL, ISC_FALSE, NULL);
if (isc_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
isc_result_totext(isc_result));
t_result(T_UNRESOLVED);
return;
}
dh(name, 18602, name, 48957, mctx, ISC_R_SUCCESS, &nfails, &nprobs);
@ -674,7 +686,14 @@ t2_sigchk(char *datapath, char *sigpath, char *keyname,
name = dns_fixedname_name(&fname);
isc_buffer_init(&b, keyname, strlen(keyname));
isc_buffer_add(&b, strlen(keyname));
dns_name_fromtext(name, &b, dns_rootname, ISC_FALSE, NULL);
isc_result = dns_name_fromtext(name, &b, dns_rootname, ISC_FALSE, NULL);
if (isc_result != ISC_R_SUCCESS) {
t_info("dns_name_fromtext failed %s\n",
isc_result_totext(isc_result));
(void) free(data);
++*nprobs;
return;
}
isc_result = dst_key_fromfile(name, id, alg, type, NULL, mctx, &key);
if (isc_result != ISC_R_SUCCESS) {
t_info("dst_key_fromfile failed %s\n",

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: t_master.c,v 1.32 2004/03/05 04:58:49 marka Exp $ */
/* $Id: t_master.c,v 1.33 2005/11/30 03:33:48 marka Exp $ */
#include <config.h>
@ -153,8 +153,10 @@ test_master_x(const char *filename) {
/*
* Skip comment lines.
*/
if ((isspace(*p & 0xff)) || (*p == '#'))
if ((isspace(*p & 0xff)) || (*p == '#')) {
(void)free(p);
continue;
}
/*
* Name of data file, origin, zclass, expected result.

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: t_names.c,v 1.38 2005/04/29 00:22:41 marka Exp $ */
/* $Id: t_names.c,v 1.39 2005/11/30 03:33:48 marka Exp $ */
#include <config.h>
@ -568,8 +568,10 @@ t_dns_name_isabsolute(void) {
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
cnt = bustline(p, Tokens);
if (cnt == 2) {
@ -679,8 +681,10 @@ t_dns_name_hash(void) {
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
cnt = bustline(p, Tokens);
if (cnt == 4) {
@ -833,8 +837,10 @@ t_dns_name_fullcompare(void) {
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
cnt = bustline(p, Tokens);
if (cnt == 6) {
@ -951,8 +957,10 @@ t_dns_name_compare(void) {
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
cnt = bustline(p, Tokens);
if (cnt == 3) {
@ -1051,8 +1059,10 @@ t_dns_name_rdatacompare(void) {
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
cnt = bustline(p, Tokens);
if (cnt == 3) {
@ -1147,8 +1157,10 @@ t_dns_name_issubdomain(void) {
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
cnt = bustline(p, Tokens);
if (cnt == 3) {
@ -1228,8 +1240,10 @@ t_dns_name_countlabels(void) {
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
cnt = bustline(p, Tokens);
if (cnt == 2) {
@ -1338,8 +1352,10 @@ t_dns_name_getlabel(void) {
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
cnt = bustline(p, Tokens);
if (cnt == 4) {
@ -1466,8 +1482,10 @@ t_dns_name_getlabelsequence(void) {
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
cnt = bustline(p, Tokens);
if (cnt == 5) {
@ -1554,8 +1572,10 @@ t_dns_name_fromregion(void) {
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
cnt = bustline(p, Tokens);
if (cnt == 1) {
@ -1602,8 +1622,10 @@ t_dns_name_toregion(void) {
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
cnt = bustline(p, Tokens);
if (cnt == 1) {
@ -1737,8 +1759,10 @@ t_dns_name_fromtext(void) {
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
cnt = bustline(p, Tokens);
if (cnt == 4) {
@ -1871,8 +1895,10 @@ t_dns_name_totext(void) {
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
cnt = bustline(p, Tokens);
if (cnt == 2) {
@ -2030,8 +2056,10 @@ t_dns_name_fromwire_x(const char *testfile, size_t buflen) {
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
cnt = bustline(p, Tokens);
if (cnt == 6) {
@ -2223,8 +2251,10 @@ t_dns_name_towire_x(const char *testfile, size_t buflen) {
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
cnt = bustline(p, Tokens);
if (cnt == 5) {

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: t_rbt.c,v 1.26 2004/10/25 01:27:54 marka Exp $ */
/* $Id: t_rbt.c,v 1.27 2005/11/30 03:33:48 marka Exp $ */
#include <config.h>
@ -127,6 +127,7 @@ create_name(char *s, isc_mem_t *mctx, dns_name_t **dns_name) {
isc_result_t result;
isc_buffer_t source;
isc_buffer_t target;
dns_name_t *name;
nfails = 0;
@ -141,22 +142,26 @@ create_name(char *s, isc_mem_t *mctx, dns_name_t **dns_name) {
* The buffer for the actual name will immediately follow the
* name structure.
*/
*dns_name = isc_mem_get(mctx, sizeof(**dns_name) + DNSNAMELEN);
if (*dns_name == NULL) {
name = isc_mem_get(mctx, sizeof(*name) + DNSNAMELEN);
if (name == NULL) {
t_info("isc_mem_get failed\n");
++nfails;
}
} else {
dns_name_init(*dns_name, NULL);
isc_buffer_init(&target, *dns_name + 1, DNSNAMELEN);
dns_name_init(name, NULL);
isc_buffer_init(&target, name + 1, DNSNAMELEN);
result = dns_name_fromtext(*dns_name, &source, dns_rootname,
ISC_FALSE, &target);
result = dns_name_fromtext(name, &source, dns_rootname,
ISC_FALSE, &target);
if (result != ISC_R_SUCCESS) {
++nfails;
t_info("dns_name_fromtext(%s) failed %s\n",
s, dns_result_totext(result));
if (result != ISC_R_SUCCESS) {
++nfails;
t_info("dns_name_fromtext(%s) failed %s\n",
s, dns_result_totext(result));
isc_mem_put(mctx, name,
sizeof(*name) + DNSNAMELEN);
} else
*dns_name = name;
}
} else {
++nfails;
@ -182,15 +187,17 @@ t1_add(char *name, dns_rbt_t *rbt, isc_mem_t *mctx, isc_result_t *dns_result) {
nprobs = 0;
if (name && dns_result) {
*dns_result = create_name(name, mctx, &dns_name);
if (*dns_result == ISC_R_SUCCESS) {
if (create_name(name, mctx, &dns_name) == 0) {
if (T_debug)
t_info("dns_rbt_addname succeeded\n");
*dns_result = dns_rbt_addname(rbt, dns_name, dns_name);
if (*dns_result != ISC_R_SUCCESS) {
delete_name(dns_name, mctx);
t_info("dns_rbt_addname failed %s\n",
dns_result_totext(*dns_result));
++nprobs;
}
} else {
t_info("dns_rbt_addname failed %s\n",
dns_result_totext(*dns_result));
delete_name(dns_name, mctx);
++nprobs;
}
} else {
@ -208,8 +215,7 @@ t1_delete(char *name, dns_rbt_t *rbt, isc_mem_t *mctx,
nprobs = 0;
if (name && dns_result) {
*dns_result = create_name(name, mctx, &dns_name);
if (*dns_result == ISC_R_SUCCESS) {
if (create_name(name, mctx, &dns_name) == 0) {
*dns_result = dns_rbt_deletename(rbt, dns_name,
ISC_FALSE);
delete_name(dns_name, mctx);
@ -234,8 +240,7 @@ t1_search(char *name, dns_rbt_t *rbt, isc_mem_t *mctx,
nprobs = 0;
if (name && dns_result) {
*dns_result = create_name(name, mctx, &dns_searchname);
if (*dns_result == ISC_R_SUCCESS) {
if (create_name(name, mctx, &dns_searchname) == 0) {
dns_fixedname_init(&dns_fixedname);
dns_foundname = dns_fixedname_name(&dns_fixedname);
data = NULL;
@ -281,7 +286,7 @@ rbt_init(char *filename, dns_rbt_t **rbt, isc_mem_t *mctx) {
* Skip any comment lines.
*/
if ((*p == '#') || (*p == '\0') || (*p == ' ')) {
free(p);
(void)free(p);
continue;
}
@ -362,8 +367,7 @@ test_rbt_gen(char *filename, char *command, char *testname,
if (strcmp(command, "create") == 0) {
result = T_PASS;
} else if (strcmp(command, "add") == 0) {
dns_result = create_name(testname, mctx, &dns_name);
if (dns_result == ISC_R_SUCCESS) {
if (create_name(testname, mctx, &dns_name) == 0) {
dns_result = dns_rbt_addname(rbt, dns_name, dns_name);
if (dns_result != ISC_R_SUCCESS)
@ -466,8 +470,10 @@ test_dns_rbt_x(const char *filename) {
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
/*
* Name of db file, command, testname,
@ -976,8 +982,10 @@ test_dns_rbtnodechain_init(const char *filename) {
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
cnt = t_bustline(p, Tokens);
if (cnt == 10) {
@ -1163,8 +1171,10 @@ test_dns_rbtnodechain_first(const char *filename) {
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
cnt = t_bustline(p, Tokens);
if (cnt == 5) {
@ -1354,8 +1364,10 @@ test_dns_rbtnodechain_last(const char *filename) {
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
cnt = t_bustline(p, Tokens);
if (cnt == 5) {
@ -1560,8 +1572,10 @@ test_dns_rbtnodechain_next(const char *filename) {
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
cnt = t_bustline(p, Tokens);
if (cnt == 4) {
@ -1765,8 +1779,10 @@ test_dns_rbtnodechain_prev(const char *filename) {
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
cnt = t_bustline(p, Tokens);
if (cnt == 4) {

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: keycreate.c,v 1.11 2004/06/11 00:27:05 marka Exp $ */
/* $Id: keycreate.c,v 1.12 2005/11/30 03:33:48 marka Exp $ */
#include <config.h>
@ -144,7 +144,9 @@ sendquery(isc_task_t *task, isc_event_t *event) {
isc_event_free(&event);
inet_pton(AF_INET, "10.53.0.1", &inaddr);
result = ISC_R_FAILURE;
if (inet_pton(AF_INET, "10.53.0.1", &inaddr) != 1)
CHECK("inet_pton", result);
isc_sockaddr_fromin(&address, &inaddr, PORT);
dns_fixedname_init(&keyname);

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: keydelete.c,v 1.7 2004/06/11 00:27:06 marka Exp $ */
/* $Id: keydelete.c,v 1.8 2005/11/30 03:33:48 marka Exp $ */
#include <config.h>
@ -118,7 +118,9 @@ sendquery(isc_task_t *task, isc_event_t *event) {
isc_event_free(&event);
inet_pton(AF_INET, "10.53.0.1", &inaddr);
result = ISC_R_FAILURE;
if (inet_pton(AF_INET, "10.53.0.1", &inaddr) != 1)
CHECK("inet_pton", result);
isc_sockaddr_fromin(&address, &inaddr, PORT);
query = NULL;

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: t_tasks.c,v 1.37 2005/07/19 05:57:12 marka Exp $ */
/* $Id: t_tasks.c,v 1.38 2005/11/30 03:33:48 marka Exp $ */
#include <config.h>
@ -2131,6 +2131,7 @@ t13(void) {
#define T14_NTASKS 10
#define T14_EXCLTASK 6
int t14_exclusiveerror = ISC_R_SUCCESS;
int t14_error = 0;
int t14_done = 0;
@ -2146,8 +2147,12 @@ t14_callback(isc_task_t *task, isc_event_t *event) {
t_info("task enter %d\n", taskno);
if (taskno == T14_EXCLTASK) {
int i;
isc_task_beginexclusive(task);
t_info("task %d got exclusive access\n", taskno);
t14_exclusiveerror = isc_task_beginexclusive(task);
if (t14_exclusiveerror == ISC_R_SUCCESS)
t_info("task %d got exclusive access\n", taskno);
else
t_info("task %d failed to got exclusive access: %d\n",
taskno, t14_exclusiveerror);
for (i = 0; i < T14_NTASKS; i++) {
t_info("task %d state %d\n", i , t14_active[i]);
if (t14_active[i])
@ -2251,8 +2256,11 @@ t_tasks14(void) {
isc_taskmgr_destroy(&manager);
if (t14_error) {
t_info("mutual access occurred\n");
if (t14_exclusiveerror != ISC_R_SUCCESS || t14_error) {
if (t14_exclusiveerror != ISC_R_SUCCESS)
t_info("isc_task_beginexclusive() failed\n");
if (t14_error)
t_info("mutual access occurred\n");
return(T_FAIL);
}

View file

@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: acache.c,v 1.10 2005/07/12 01:00:13 marka Exp $ */
/* $Id: acache.c,v 1.11 2005/11/30 03:33:48 marka Exp $ */
#include <config.h>
@ -1235,7 +1235,12 @@ dns_acache_createentry(dns_acache_t *acache, dns_db_t *origdb,
return (result);
};
isc_refcount_init(&newentry->references, 1);
result = isc_refcount_init(&newentry->references, 1);
if (result != ISC_R_SUCCESS) {
ACACHE_DESTROYLOCK(&newentry->lock);
isc_mem_put(acache->mctx, newentry, sizeof(*newentry));
return (result);
};
ISC_LINK_INIT(newentry, link);
ISC_LINK_INIT(newentry, olink);

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: adb.c,v 1.225 2005/10/14 05:27:12 marka Exp $ */
/* $Id: adb.c,v 1.226 2005/11/30 03:33:48 marka Exp $ */
/*! \file
*
@ -2594,8 +2594,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action,
}
}
if (bucket != DNS_ADB_INVALIDBUCKET)
UNLOCK(&adb->namelocks[bucket]);
UNLOCK(&adb->namelocks[bucket]);
return (result);
}

View file

@ -16,7 +16,7 @@
*/
/*
* $Id: dnssec.c,v 1.84 2005/04/29 00:22:45 marka Exp $
* $Id: dnssec.c,v 1.85 2005/11/30 03:33:49 marka Exp $
*/
/*! \file */
@ -331,8 +331,7 @@ cleanup_array:
cleanup_context:
dst_context_destroy(&ctx);
cleanup_databuf:
if (databuf != NULL)
isc_buffer_free(&databuf);
isc_buffer_free(&databuf);
cleanup_signature:
isc_mem_put(mctx, sig.signature, sig.siglen);

View file

@ -18,7 +18,7 @@
/*
* Principal Author: Brian Wellington
* $Id: dst_api.c,v 1.4 2005/06/17 02:22:43 marka Exp $
* $Id: dst_api.c,v 1.5 2005/11/30 03:33:49 marka Exp $
*/
/*! \file */
@ -416,6 +416,7 @@ dst_key_fromnamedfile(const char *filename, int type, isc_mem_t *mctx,
result = dst_key_read_public(newfilename, type, mctx, &pubkey);
isc_mem_put(mctx, newfilename, newfilenamelen);
newfilename = NULL;
if (result != ISC_R_SUCCESS)
return (result);
@ -1039,8 +1040,10 @@ write_public_key(const dst_key_t *key, int type, const char *directory) {
}
ret = dns_name_print(key->key_name, fp);
if (ret != ISC_R_SUCCESS)
if (ret != ISC_R_SUCCESS) {
fclose(fp);
return (ret);
}
fprintf(fp, " ");

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: lookup.c,v 1.17 2005/04/29 00:22:48 marka Exp $ */
/* $Id: lookup.c,v 1.18 2005/11/30 03:33:49 marka Exp $ */
/*! \file */
@ -156,11 +156,6 @@ build_event(dns_lookup_t *lookup) {
dns_rdataset_disassociate(rdataset);
isc_mem_put(lookup->mctx, rdataset, sizeof(dns_rdataset_t));
}
if (sigrdataset != NULL) {
if (dns_rdataset_isassociated(sigrdataset))
dns_rdataset_disassociate(sigrdataset);
isc_mem_put(lookup->mctx, sigrdataset, sizeof(dns_rdataset_t));
}
return (result);
}
@ -231,13 +226,14 @@ lookup_find(dns_lookup_t *lookup, dns_fetchevent_t *event) {
send_event = ISC_TRUE;
goto done;
}
} else {
} else if (event != NULL) {
result = event->result;
fname = dns_fixedname_name(&event->foundname);
dns_resolver_destroyfetch(&lookup->fetch);
INSIST(event->rdataset == &lookup->rdataset);
INSIST(event->sigrdataset == &lookup->sigrdataset);
}
} else
fname = NULL; /* Silence compiler warning. */
/*
* If we've been canceled, forget about the result.

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: master.c,v 1.158 2005/09/01 02:24:58 marka Exp $ */
/* $Id: master.c,v 1.159 2005/11/30 03:33:49 marka Exp $ */
/*! \file */
@ -2172,6 +2172,10 @@ load_raw(dns_loadctx_t *lctx) {
rdatalist.covers = isc_buffer_getuint16(&target);
rdatalist.ttl = isc_buffer_getuint32(&target);
rdcount = isc_buffer_getuint32(&target);
if (rdcount == 0) {
result = ISC_R_RANGE;
goto cleanup;
}
INSIST(isc_buffer_consumedlength(&target) <= readlen);
/* Owner name: length followed by name */

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: masterdump.c,v 1.82 2005/10/21 03:13:59 marka Exp $ */
/* $Id: masterdump.c,v 1.83 2005/11/30 03:33:49 marka Exp $ */
/*! \file */
@ -1448,9 +1448,8 @@ dns_master_dumptostreaminc(isc_mem_t *mctx, dns_db_t *db,
dns_dumpctx_attach(dctx, dctxp);
return (DNS_R_CONTINUE);
}
if (dctx != NULL)
dns_dumpctx_detach(&dctx);
dns_dumpctx_detach(&dctx);
return (result);
}

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: message.c,v 1.227 2005/06/07 01:42:29 marka Exp $ */
/* $Id: message.c,v 1.228 2005/11/30 03:33:49 marka Exp $ */
/*! \file */
@ -808,6 +808,7 @@ dns_message_findtype(dns_name_t *name, dns_rdatatype_t type,
{
dns_rdataset_t *curr;
REQUIRE(name != NULL);
if (rdataset != NULL) {
REQUIRE(*rdataset == NULL);
}

View file

@ -17,7 +17,7 @@
/*
* Principal Author: Brian Wellington
* $Id: opensslrsa_link.c,v 1.4 2005/06/17 02:22:44 marka Exp $
* $Id: opensslrsa_link.c,v 1.5 2005/11/30 03:33:49 marka Exp $
*/
#ifdef OPENSSL
@ -87,12 +87,16 @@ opensslrsa_createctx(dst_key_t *key, dst_context_t *dctx) {
isc_md5_t *md5ctx;
md5ctx = isc_mem_get(dctx->mctx, sizeof(isc_md5_t));
if (md5ctx == NULL)
return (ISC_R_NOMEMORY);
isc_md5_init(md5ctx);
dctx->opaque = md5ctx;
} else {
isc_sha1_t *sha1ctx;
sha1ctx = isc_mem_get(dctx->mctx, sizeof(isc_sha1_t));
if (sha1ctx == NULL)
return (ISC_R_NOMEMORY);
isc_sha1_init(sha1ctx);
dctx->opaque = sha1ctx;
}

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: resolver.c,v 1.319 2005/11/03 00:51:54 marka Exp $ */
/* $Id: resolver.c,v 1.320 2005/11/30 03:33:49 marka Exp $ */
/*! \file */
@ -3309,6 +3309,7 @@ validated(isc_task_t *task, isc_event_t *event) {
result = dns_rdataset_addnoqname(vevent->rdataset,
vevent->proofs[DNS_VALIDATOR_NOQNAMEPROOF]);
RUNTIME_CHECK(result == ISC_R_SUCCESS);
INSIST(vevent->sigrdataset != NULL);
vevent->sigrdataset->ttl = vevent->rdataset->ttl;
}

View file

@ -50,7 +50,7 @@
* USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: sdlz.c,v 1.6 2005/11/02 23:22:33 marka Exp $ */
/* $Id: sdlz.c,v 1.7 2005/11/30 03:33:49 marka Exp $ */
/*! \file */
@ -1471,7 +1471,7 @@ dns_sdlz_putrr(dns_sdlzlookup_t *lookup, const char *type, dns_ttl_t ttl,
dns_rdatatype_t typeval;
isc_consttextregion_t r;
isc_buffer_t b;
isc_buffer_t *rdatabuf;
isc_buffer_t *rdatabuf = NULL;
isc_lex_t *lex;
isc_result_t result;
unsigned int size;

View file

@ -16,7 +16,7 @@
*/
/*
* $Id: tkey.c,v 1.80 2005/06/10 06:58:27 marka Exp $
* $Id: tkey.c,v 1.81 2005/11/30 03:33:49 marka Exp $
*/
/*! \file */
#include <config.h>
@ -441,15 +441,17 @@ process_gsstkey(dns_message_t *msg, dns_name_t *signer, dns_name_t *name,
dstkey, ISC_TRUE, signer,
tkeyin->inception, tkeyin->expire,
msg->mctx, ring, NULL);
#if 1
if (result != ISC_R_SUCCESS)
goto failure;
#else
if (result == ISC_R_NOTFOUND) {
tkeyout->error = dns_tsigerror_badalg;
return (ISC_R_SUCCESS);
}
if (result != ISC_R_SUCCESS)
goto failure;
#endif
/* This key is good for a long time */
isc_stdtime_get(&now);

View file

@ -16,7 +16,7 @@
*/
/*
* $Id: tsig.c,v 1.121 2005/07/12 01:00:16 marka Exp $
* $Id: tsig.c,v 1.122 2005/11/30 03:33:49 marka Exp $
*/
/*! \file */
#include <config.h>
@ -378,7 +378,7 @@ dns_tsig_sign(dns_message_t *msg) {
isc_buffer_t databuf, sigbuf;
isc_buffer_t *dynbuf;
dns_name_t *owner;
dns_rdata_t *rdata;
dns_rdata_t *rdata = NULL;
dns_rdatalist_t *datalist;
dns_rdataset_t *dataset;
isc_region_t r;
@ -570,7 +570,6 @@ dns_tsig_sign(dns_message_t *msg) {
tsig.signature = NULL;
}
rdata = NULL;
ret = dns_message_gettemprdata(msg, &rdata);
if (ret != ISC_R_SUCCESS)
goto cleanup_signature;
@ -592,7 +591,7 @@ dns_tsig_sign(dns_message_t *msg) {
owner = NULL;
ret = dns_message_gettempname(msg, &owner);
if (ret != ISC_R_SUCCESS)
goto cleanup_dynbuf;
goto cleanup_context;
dns_name_init(owner, NULL);
ret = dns_name_dup(&key->name, msg->mctx, owner);
if (ret != ISC_R_SUCCESS)
@ -602,16 +601,16 @@ dns_tsig_sign(dns_message_t *msg) {
ret = dns_message_gettemprdatalist(msg, &datalist);
if (ret != ISC_R_SUCCESS)
goto cleanup_owner;
dataset = NULL;
ret = dns_message_gettemprdataset(msg, &dataset);
if (ret != ISC_R_SUCCESS)
goto cleanup_rdatalist;
datalist->rdclass = dns_rdataclass_any;
datalist->type = dns_rdatatype_tsig;
datalist->covers = 0;
datalist->ttl = 0;
ISC_LIST_INIT(datalist->rdata);
ISC_LIST_APPEND(datalist->rdata, rdata, link);
dataset = NULL;
ret = dns_message_gettemprdataset(msg, &dataset);
if (ret != ISC_R_SUCCESS)
goto cleanup_owner;
dns_rdataset_init(dataset);
RUNTIME_CHECK(dns_rdatalist_tordataset(datalist, dataset)
== ISC_R_SUCCESS);
@ -620,18 +619,22 @@ dns_tsig_sign(dns_message_t *msg) {
return (ISC_R_SUCCESS);
cleanup_owner:
if (owner != NULL)
dns_message_puttempname(msg, &owner);
cleanup_dynbuf:
if (dynbuf != NULL)
isc_buffer_free(&dynbuf);
cleanup_signature:
cleanup_rdatalist:
dns_message_puttemprdatalist(msg, &datalist);
cleanup_owner:
dns_message_puttempname(msg, &owner);
goto cleanup_context;
cleanup_dynbuf:
isc_buffer_free(&dynbuf);
cleanup_signature:
if (tsig.signature != NULL)
isc_mem_put(mctx, tsig.signature, sigsize);
cleanup_context:
if (ctx != NULL)
dst_context_destroy(&ctx);
cleanup_context:
if (rdata != NULL)
dns_message_puttemprdata(msg, &rdata);
dst_context_destroy(&ctx);
return (ret);
}

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: validator.c,v 1.135 2005/11/03 00:51:55 marka Exp $ */
/* $Id: validator.c,v 1.136 2005/11/30 03:33:49 marka Exp $ */
/*! \file */
@ -2819,7 +2819,7 @@ dns_validator_create(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
cleanup_event:
isc_task_detach(&tclone);
isc_event_free((isc_event_t **)&val->event);
isc_event_free((isc_event_t **)&event);
cleanup_val:
dns_view_weakdetach(&val->view);

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zone.c,v 1.445 2005/08/24 23:54:02 marka Exp $ */
/* $Id: zone.c,v 1.446 2005/11/30 03:33:49 marka Exp $ */
/*! \file */
@ -832,12 +832,10 @@ dns_zone_setdbtype(dns_zone_t *zone,
nomem:
if (new != NULL) {
for (i = 0; i < dbargc; i++) {
if (zone->db_argv[i] != NULL)
for (i = 0; i < dbargc; i++)
if (new[i] != NULL)
isc_mem_free(zone->mctx, new[i]);
isc_mem_put(zone->mctx, new,
dbargc * sizeof(*new));
}
isc_mem_put(zone->mctx, new, dbargc * sizeof(*new));
}
result = ISC_R_NOMEMORY;
@ -1326,10 +1324,12 @@ zone_startload(dns_db_t *db, dns_zone_t *zone, isc_time_t loadtime) {
zone_gotreadhandle, load,
&zone->readio);
if (result != ISC_R_SUCCESS) {
tresult = dns_db_endload(load->db,
&load->callbacks.add_private);
if (result == ISC_R_SUCCESS)
result = tresult;
/*
* We can't report multiple errors so ignore
* the result of dns_db_endload().
*/
(void)dns_db_endload(load->db,
&load->callbacks.add_private);
goto cleanup;
} else
result = DNS_R_CONTINUE;
@ -2853,6 +2853,7 @@ dns_zone_refresh(dns_zone_t *zone) {
isc_interval_t i;
isc_uint32_t oldflags;
unsigned int j;
isc_result_t result;
REQUIRE(DNS_ZONE_VALID(zone));
@ -2886,7 +2887,11 @@ dns_zone_refresh(dns_zone_t *zone) {
*/
isc_interval_set(&i, isc_random_jitter(zone->retry, zone->retry / 4),
0);
isc_time_nowplusinterval(&zone->refreshtime, &i);
result = isc_time_nowplusinterval(&zone->refreshtime, &i);
if (result |= ISC_R_SUCCESS)
dns_zone_log(zone, ISC_LOG_WARNING,
"isc_time_nowplusinterval() failed: %s",
dns_result_totext(result));
/*
* When lacking user-specified timer values from the SOA,

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zt.c,v 1.42 2005/07/12 01:00:17 marka Exp $ */
/* $Id: zt.c,v 1.43 2005/11/30 03:33:49 marka Exp $ */
/*! \file */
@ -380,9 +380,8 @@ dns_zt_apply2(dns_zt_t *zt, isc_boolean_t stop, isc_result_t *sub,
tresult = result;
goto cleanup; /* don't break */
} else if (result != ISC_R_SUCCESS &&
tresult != ISC_R_SUCCESS)
tresult == ISC_R_SUCCESS)
tresult = result;
}
result = dns_rbtnodechain_next(&chain, NULL, NULL);
}

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: lex.c,v 1.82 2005/06/04 00:18:55 marka Exp $ */
/* $Id: lex.c,v 1.83 2005/11/30 03:33:49 marka Exp $ */
/*! \file */
@ -374,9 +374,6 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
source = HEAD(lex->sources);
REQUIRE(tokenp != NULL);
lex->saved_paren_count = lex->paren_count;
source->saved_line = source->line;
if (source == NULL) {
if ((options & ISC_LEXOPT_NOMORE) != 0) {
tokenp->type = isc_tokentype_nomore;
@ -388,6 +385,9 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
if (source->result != ISC_R_SUCCESS)
return (source->result);
lex->saved_paren_count = lex->paren_count;
source->saved_line = source->line;
if (isc_buffer_remaininglength(source->pushback) == 0 &&
source->at_eof)
{
@ -627,10 +627,10 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
(lex->data[0] != '0'))) {
/* Above test supports hex numbers */
state = lexstate_string;
} else if ((options & ISC_LEXOPT_OCTAL) != 0 &&
(c == '8' || c == '9')) {
state = lexstate_string;
}
} else if ((options & ISC_LEXOPT_OCTAL) != 0 &&
(c == '8' || c == '9')) {
state = lexstate_string;
}
if (remaining == 0U) {
result = grow_data(lex, &remaining,
@ -644,9 +644,13 @@ isc_lex_gettoken(isc_lex_t *lex, unsigned int options, isc_token_t *tokenp) {
remaining--;
break;
case lexstate_string:
if ((!escaped &&
(c == ' ' || c == '\t' || lex->specials[c])) ||
c == '\r' || c == '\n' || c == EOF) {
/*
* EOF needs to be checked before lex->specials[c]
* as lex->specials[EOF] is not a good idea.
*/
if (c == '\r' || c == '\n' || c == EOF ||
(!escaped &&
(c == ' ' || c == '\t' || lex->specials[c]))) {
pushback(source, c);
if (source->result != ISC_R_SUCCESS) {
result = source->result;

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: taskpool.c,v 1.14 2005/04/29 00:23:32 marka Exp $ */
/* $Id: taskpool.c,v 1.15 2005/11/30 03:33:49 marka Exp $ */
/*! \file */
@ -54,6 +54,10 @@ isc_taskpool_create(isc_taskmgr_t *tmgr, isc_mem_t *mctx,
pool->mctx = mctx;
pool->ntasks = ntasks;
pool->tasks = isc_mem_get(mctx, ntasks * sizeof(isc_task_t *));
if (pool->tasks == NULL) {
isc_mem_put(mctx, pool, sizeof(*pool));
return (ISC_R_NOMEMORY);
}
for (i = 0; i < ntasks; i++)
pool->tasks[i] = NULL;
for (i = 0; i < ntasks; i++) {

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: timer.c,v 1.77 2005/10/26 06:46:36 marka Exp $ */
/* $Id: timer.c,v 1.78 2005/11/30 03:33:49 marka Exp $ */
/*! \file */
@ -214,9 +214,10 @@ schedule(isc_timer_t *timer, isc_time_t *now, isc_boolean_t signal_ok) {
isc_time_t then;
isc_interval_set(&fifteen, 15, 0);
isc_time_add(&manager->due, &fifteen, &then);
result = isc_time_add(&manager->due, &fifteen, &then);
if (isc_time_compare(&then, now) < 0) {
if (result == ISC_R_SUCCESS &&
isc_time_compare(&then, now) < 0) {
SIGNAL(&manager->wakeup);
signal_ok = ISC_FALSE;
isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL,
@ -349,8 +350,10 @@ isc_timer_create(isc_timermgr_t *manager, isc_timertype_t type,
if (type == isc_timertype_once && !isc_interval_iszero(interval)) {
result = isc_time_add(&now, interval, &timer->idle);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS) {
isc_mem_put(manager->mctx, timer, sizeof(*timer));
return (result);
}
} else
isc_time_settoepoch(&timer->idle);

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: socket.c,v 1.256 2005/11/03 22:59:53 marka Exp $ */
/* $Id: socket.c,v 1.257 2005/11/30 03:33:49 marka Exp $ */
/*! \file */
@ -2716,8 +2716,8 @@ socket_send(isc_socket_t *sock, isc_socketevent_t *dev, isc_task_t *task,
dev->attributes |= ISC_SOCKEVENTATTR_PKTINFO;
dev->pktinfo = *pktinfo;
if (!isc_sockaddr_issitelocal(address) &&
!isc_sockaddr_islinklocal(address)) {
if (!isc_sockaddr_issitelocal(&dev->address) &&
!isc_sockaddr_islinklocal(&dev->address)) {
socket_log(sock, NULL, TRACE, isc_msgcat,
ISC_MSGSET_SOCKET, ISC_MSG_PKTINFOPROVIDED,
"pktinfo structure provided, ifindex %u "

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: parser.c,v 1.119 2005/09/05 00:11:05 marka Exp $ */
/* $Id: parser.c,v 1.120 2005/11/30 03:33:49 marka Exp $ */
/*! \file */
@ -1569,12 +1569,19 @@ parse_token(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
isc_lex_getlasttokentext(pctx->lexer, &pctx->token, &r);
obj->value.string.base = isc_mem_get(pctx->mctx, r.length + 1);
if (obj->value.string.base == NULL) {
result = ISC_R_NOMEMORY;
goto cleanup;
}
obj->value.string.length = r.length;
memcpy(obj->value.string.base, r.base, r.length);
obj->value.string.base[r.length] = '\0';
*ret = obj;
return (result);
cleanup:
if (obj != NULL)
isc_mem_put(pctx->mctx, obj, sizeof(*obj));
return (result);
}
@ -1809,8 +1816,6 @@ cfg_doc_netaddr(cfg_printer_t *pctx, const cfg_type_t *type) {
if (*flagp != CFG_ADDR_V4OK && *flagp != CFG_ADDR_V6OK)
cfg_print_chars(pctx, "( ", 2);
if (*flagp & CFG_ADDR_V4OK) {
if (n != 0)
cfg_print_chars(pctx, " | ", 3);
cfg_print_cstr(pctx, "<ipv4_address>");
n++;
}
@ -1997,8 +2002,6 @@ cfg_doc_sockaddr(cfg_printer_t *pctx, const cfg_type_t *type) {
int n = 0;
cfg_print_chars(pctx, "( ", 2);
if (*flagp & CFG_ADDR_V4OK) {
if (n != 0)
cfg_print_chars(pctx, " | ", 3);
cfg_print_cstr(pctx, "<ipv4_address>");
n++;
}
@ -2291,7 +2294,6 @@ create_map(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
CHECK(isc_symtab_create(pctx->mctx, 5, /* XXX */
map_symtabitem_destroy,
pctx, ISC_FALSE, &symtab));
obj->value.map.symtab = symtab;
obj->value.map.id = NULL;

View file

@ -18,7 +18,7 @@
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: getaddrinfo.c,v 1.46 2005/06/08 02:07:01 marka Exp $ */
/* $Id: getaddrinfo.c,v 1.47 2005/11/30 03:33:49 marka Exp $ */
/*! \file */
@ -438,8 +438,10 @@ lwres_getaddrinfo(const char *hostname, const char *servname,
NULL, 0,
NI_NUMERICHOST) == 0) {
ai->ai_canonname = strdup(nbuf);
if (ai->ai_canonname == NULL)
if (ai->ai_canonname == NULL) {
lwres_freeaddrinfo(ai_list);
return (EAI_MEMORY);
}
} else {
/* XXX raise error? */
ai->ai_canonname = NULL;

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: t_api.c,v 1.57 2005/06/17 02:22:45 marka Exp $ */
/* $Id: t_api.c,v 1.58 2005/11/30 03:33:49 marka Exp $ */
/*! \file */
@ -542,7 +542,11 @@ t_fgetbs(FILE *fp) {
}
}
*p = '\0';
return(((c == EOF) && (n == 0U)) ? NULL : buf);
if (c == EOF && n == 0U) {
free(buf);
return (NULL);
}
return (buf);
} else {
fprintf(stderr, "malloc failed %d", errno);
return(NULL);
@ -749,8 +753,10 @@ t_eval(const char *filename, int (*func)(char **), int nargs) {
/*
* Skip comment lines.
*/
if ((isspace((unsigned char)*p)) || (*p == '#'))
if ((isspace((unsigned char)*p)) || (*p == '#')) {
(void)free(p);
continue;
}
cnt = t_bustline(p, tokens);
if (cnt == nargs) {