Coverity.
+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]
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dnssec-signzone.c,v 1.177.18.14 2005/10/14 01:28:20 marka Exp $ */
+/* $Id: dnssec-signzone.c,v 1.177.18.15 2005/11/30 03:44:38 marka Exp $ */
/*! \file */
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)))
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: config.c,v 1.47.18.15 2005/09/05 02:30:50 marka Exp $ */
+/* $Id: config.c,v 1.47.18.16 2005/11/30 03:44:38 marka Exp $ */
/*! \file */
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;
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;
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;
}
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: controlconf.c,v 1.40.18.5 2005/08/23 02:31:30 marka Exp $ */
+/* $Id: controlconf.c,v 1.40.18.6 2005/11/30 03:44:38 marka Exp $ */
/*! \file */
{
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;
*/
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;
result = get_rndckey(listener->mctx, &listener->keys);
}
- if (result != ISC_R_SUCCESS && global_keylist != NULL)
+ if (result != ISC_R_SUCCESS && global_keylist != NULL) {
/*
* This message might be a little misleading since the
* "new keys" might in fact be identical to the old ones,
* 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.
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;
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);
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: interfacemgr.c,v 1.76.18.5 2005/04/27 05:00:30 sra Exp $ */
+/* $Id: interfacemgr.c,v 1.76.18.6 2005/11/30 03:44:38 marka Exp $ */
/*! \file */
* 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;
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
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lwdgrbn.c,v 1.13.18.2 2005/04/29 00:15:24 marka Exp $ */
+/* $Id: lwdgrbn.c,v 1.13.18.3 2005/11/30 03:44:38 marka Exp $ */
/*! \file */
client->sendlength = r.length;
result = ns_lwdclient_sendreply(client, &r);
if (result != ISC_R_SUCCESS)
- goto out;
+ goto out2;
NS_LWDCLIENT_SETSEND(client);
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)
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lwresd.c,v 1.46.18.4 2005/08/23 02:31:33 marka Exp $ */
+/* $Id: lwresd.c,v 1.46.18.5 2005/11/30 03:44:38 marka Exp $ */
/*! \file
* \brief
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);
}
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: query.c,v 1.257.18.19 2005/11/02 01:37:35 marka Exp $ */
+/* $Id: query.c,v 1.257.18.20 2005/11/30 03:44:38 marka Exp $ */
/*! \file */
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];
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: server.c,v 1.419.18.32 2005/09/05 00:18:11 marka Exp $ */
+/* $Id: server.c,v 1.419.18.33 2005/11/30 03:44:38 marka Exp $ */
/*! \file */
}
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.
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);
* 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));
* 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
clean:
INSIST(lelt == NULL);
- if (src_acl != NULL)
- dns_acl_detach(&src_acl);
+ dns_acl_detach(&src_acl);
return (result);
}
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);
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,
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: zoneconf.c,v 1.110.18.14 2005/08/25 00:05:43 marka Exp $ */
+/* $Id: zoneconf.c,v 1.110.18.15 2005/11/30 03:44:38 marka Exp $ */
/*% */
switch (ztype) {
case dns_zone_slave:
case dns_zone_stub:
+ count = 0;
obj = NULL;
result = cfg_map_get(zoptions, "masters", &obj);
if (obj != NULL) {
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: t_db.c,v 1.31.18.1 2004/10/25 01:32:24 marka Exp $ */
+/* $Id: t_db.c,v 1.31.18.2 2005/11/30 03:44:38 marka Exp $ */
#include <config.h>
/*
* 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) {
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: dst_test.c,v 1.38.18.1 2004/06/11 00:30:11 marka Exp $ */
+/* $Id: dst_test.c,v 1.38.18.2 2005/11/30 03:44:38 marka Exp $ */
#include <config.h>
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);
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);
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: t_dst.c,v 1.48.18.1 2004/06/11 00:30:11 marka Exp $ */
+/* $Id: t_dst.c,v 1.48.18.2 2005/11/30 03:44:38 marka Exp $ */
#include <config.h>
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");
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);
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",
* 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.32.18.1 2005/11/30 03:44:38 marka Exp $ */
#include <config.h>
/*
* 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.
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: t_names.c,v 1.36.18.2 2005/04/29 00:15:46 marka Exp $ */
+/* $Id: t_names.c,v 1.36.18.3 2005/11/30 03:44:38 marka Exp $ */
#include <config.h>
/*
* 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) {
/*
* 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) {
/*
* 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) {
/*
* 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) {
/*
* 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) {
/*
* 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) {
/*
* 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) {
/*
* 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) {
/*
* 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) {
/*
* 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) {
/*
* 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) {
/*
* 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) {
/*
* 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) {
/*
* 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) {
/*
* 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) {
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: t_rbt.c,v 1.25.18.1 2004/10/25 01:32:25 marka Exp $ */
+/* $Id: t_rbt.c,v 1.25.18.2 2005/11/30 03:44:38 marka Exp $ */
#include <config.h>
isc_result_t result;
isc_buffer_t source;
isc_buffer_t target;
+ dns_name_t *name;
nfails = 0;
* 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;
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 {
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);
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;
* Skip any comment lines.
*/
if ((*p == '#') || (*p == '\0') || (*p == ' ')) {
- free(p);
+ (void)free(p);
continue;
}
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)
/*
* 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,
/*
* 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) {
/*
* 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) {
/*
* 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) {
/*
* 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) {
/*
* 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) {
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: keycreate.c,v 1.10.18.1 2004/06/11 00:30:12 marka Exp $ */
+/* $Id: keycreate.c,v 1.10.18.2 2005/11/30 03:44:38 marka Exp $ */
#include <config.h>
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);
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: keydelete.c,v 1.6.18.1 2004/06/11 00:30:12 marka Exp $ */
+/* $Id: keydelete.c,v 1.6.18.2 2005/11/30 03:44:39 marka Exp $ */
#include <config.h>
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;
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: t_tasks.c,v 1.32.18.5 2005/07/19 06:20:19 marka Exp $ */
+/* $Id: t_tasks.c,v 1.32.18.6 2005/11/30 03:44:39 marka Exp $ */
#include <config.h>
#define T14_NTASKS 10
#define T14_EXCLTASK 6
+int t14_exclusiveerror = ISC_R_SUCCESS;
int t14_error = 0;
int t14_done = 0;
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])
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);
}
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: acache.c,v 1.3.2.8 2005/07/12 01:22:18 marka Exp $ */
+/* $Id: acache.c,v 1.3.2.9 2005/11/30 03:44:39 marka Exp $ */
#include <config.h>
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);
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: adb.c,v 1.215.18.10 2005/10/14 05:26:54 marka Exp $ */
+/* $Id: adb.c,v 1.215.18.11 2005/11/30 03:44:39 marka Exp $ */
/*! \file
*
}
}
- if (bucket != DNS_ADB_INVALIDBUCKET)
- UNLOCK(&adb->namelocks[bucket]);
+ UNLOCK(&adb->namelocks[bucket]);
return (result);
}
*/
/*
- * $Id: dnssec.c,v 1.81.18.3 2005/04/29 00:15:50 marka Exp $
+ * $Id: dnssec.c,v 1.81.18.4 2005/11/30 03:44:39 marka Exp $
*/
/*! \file */
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);
/*
* Principal Author: Brian Wellington
- * $Id: dst_api.c,v 1.1.6.4 2005/06/17 02:27:13 marka Exp $
+ * $Id: dst_api.c,v 1.1.6.5 2005/11/30 03:44:39 marka Exp $
*/
/*! \file */
result = dst_key_read_public(newfilename, type, mctx, &pubkey);
isc_mem_put(mctx, newfilename, newfilenamelen);
+ newfilename = NULL;
if (result != ISC_R_SUCCESS)
return (result);
}
ret = dns_name_print(key->key_name, fp);
- if (ret != ISC_R_SUCCESS)
+ if (ret != ISC_R_SUCCESS) {
+ fclose(fp);
return (ret);
+ }
fprintf(fp, " ");
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lookup.c,v 1.14.18.3 2005/04/29 00:15:58 marka Exp $ */
+/* $Id: lookup.c,v 1.14.18.4 2005/11/30 03:44:39 marka Exp $ */
/*! \file */
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);
}
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.
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: master.c,v 1.148.18.10 2005/09/01 03:04:27 marka Exp $ */
+/* $Id: master.c,v 1.148.18.11 2005/11/30 03:44:39 marka Exp $ */
/*! \file */
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 */
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: masterdump.c,v 1.73.18.9 2005/10/21 03:19:35 marka Exp $ */
+/* $Id: masterdump.c,v 1.73.18.10 2005/11/30 03:44:39 marka Exp $ */
/*! \file */
dns_dumpctx_attach(dctx, dctxp);
return (DNS_R_CONTINUE);
}
- if (dctx != NULL)
- dns_dumpctx_detach(&dctx);
+ dns_dumpctx_detach(&dctx);
return (result);
}
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: message.c,v 1.222.18.5 2005/06/07 01:43:52 marka Exp $ */
+/* $Id: message.c,v 1.222.18.6 2005/11/30 03:44:39 marka Exp $ */
/*! \file */
{
dns_rdataset_t *curr;
+ REQUIRE(name != NULL);
if (rdataset != NULL) {
REQUIRE(*rdataset == NULL);
}
/*
* Principal Author: Brian Wellington
- * $Id: opensslrsa_link.c,v 1.1.6.4 2005/06/17 02:27:14 marka Exp $
+ * $Id: opensslrsa_link.c,v 1.1.6.5 2005/11/30 03:44:39 marka Exp $
*/
#ifdef OPENSSL
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;
}
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: resolver.c,v 1.284.18.35 2005/11/03 00:57:59 marka Exp $ */
+/* $Id: resolver.c,v 1.284.18.36 2005/11/30 03:44:39 marka Exp $ */
/*! \file */
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;
}
* USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: sdlz.c,v 1.2.2.4 2005/11/02 23:29:50 marka Exp $ */
+/* $Id: sdlz.c,v 1.2.2.5 2005/11/30 03:44:39 marka Exp $ */
/*! \file */
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;
*/
/*
- * $Id: tkey.c,v 1.76.18.4 2005/06/10 07:03:25 marka Exp $
+ * $Id: tkey.c,v 1.76.18.5 2005/11/30 03:44:39 marka Exp $
*/
/*! \file */
#include <config.h>
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);
*/
/*
- * $Id: tsig.c,v 1.117.18.4 2005/07/12 01:22:25 marka Exp $
+ * $Id: tsig.c,v 1.117.18.5 2005/11/30 03:44:39 marka Exp $
*/
/*! \file */
#include <config.h>
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;
tsig.signature = NULL;
}
- rdata = NULL;
ret = dns_message_gettemprdata(msg, &rdata);
if (ret != ISC_R_SUCCESS)
goto cleanup_signature;
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)
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);
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);
}
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: validator.c,v 1.119.18.16 2005/11/03 00:57:59 marka Exp $ */
+/* $Id: validator.c,v 1.119.18.17 2005/11/30 03:44:39 marka Exp $ */
/*! \file */
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);
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: zone.c,v 1.410.18.35 2005/08/25 00:05:45 marka Exp $ */
+/* $Id: zone.c,v 1.410.18.36 2005/11/30 03:44:39 marka Exp $ */
/*! \file */
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;
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;
isc_interval_t i;
isc_uint32_t oldflags;
unsigned int j;
+ isc_result_t result;
REQUIRE(DNS_ZONE_VALID(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,
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: zt.c,v 1.38.18.4 2005/07/12 01:22:27 marka Exp $ */
+/* $Id: zt.c,v 1.38.18.5 2005/11/30 03:44:39 marka Exp $ */
/*! \file */
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);
}
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lex.c,v 1.78.18.4 2005/06/04 00:39:04 marka Exp $ */
+/* $Id: lex.c,v 1.78.18.5 2005/11/30 03:44:39 marka Exp $ */
/*! \file */
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;
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)
{
(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,
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;
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: taskpool.c,v 1.12.18.2 2005/04/29 00:16:51 marka Exp $ */
+/* $Id: taskpool.c,v 1.12.18.3 2005/11/30 03:44:39 marka Exp $ */
/*! \file */
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++) {
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: timer.c,v 1.73.18.4 2005/10/26 06:50:49 marka Exp $ */
+/* $Id: timer.c,v 1.73.18.5 2005/11/30 03:44:39 marka Exp $ */
/*! \file */
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,
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);
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: socket.c,v 1.237.18.19 2005/11/03 23:02:23 marka Exp $ */
+/* $Id: socket.c,v 1.237.18.20 2005/11/30 03:44:39 marka Exp $ */
/*! \file */
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 "
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: parser.c,v 1.112.18.7 2005/09/05 00:18:31 marka Exp $ */
+/* $Id: parser.c,v 1.112.18.8 2005/11/30 03:44:39 marka Exp $ */
/*! \file */
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);
}
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++;
}
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++;
}
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;
* IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: getaddrinfo.c,v 1.43.18.3 2005/06/08 02:07:58 marka Exp $ */
+/* $Id: getaddrinfo.c,v 1.43.18.4 2005/11/30 03:44:39 marka Exp $ */
/*! \file */
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;
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: t_api.c,v 1.52.18.5 2005/06/17 02:27:16 marka Exp $ */
+/* $Id: t_api.c,v 1.52.18.6 2005/11/30 03:44:39 marka Exp $ */
/*! \file */
}
}
*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);
/*
* 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) {