Commit 5e589b53 authored by Mark Andrews's avatar Mark Andrews
Browse files

Uninitalised link fixes, batch 1.

parent 643f4281
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dighost.c,v 1.153 2000/10/19 22:49:30 mws Exp $ */
/* $Id: dighost.c,v 1.154 2000/10/20 02:21:33 marka Exp $ */
/*
* Notice to programmers: Do not use this code as an example of how to
......@@ -235,13 +235,14 @@ make_server(const char *servname) {
REQUIRE(servname != NULL);
debug("make_server(%s)",servname);
debug("make_server(%s)", servname);
srv = isc_mem_allocate(mctx, sizeof(struct dig_server));
if (srv == NULL)
fatal("Memory allocation failure in %s:%d",
__FILE__, __LINE__);
strncpy(srv->servername, servname, MXNAME);
srv->servername[MXNAME-1] = 0;
ISC_LINK_INIT(srv, link);
return (srv);
}
......@@ -326,6 +327,7 @@ make_empty_lookup(void) {
looknew->zonename[0] = 0;
looknew->viewname[0] = 0;
#endif /* DNS_OPT_NEWCODES_LIVE */
ISC_LINK_INIT(looknew, link);
ISC_LIST_INIT(looknew->q);
ISC_LIST_INIT(looknew->my_server_list);
return (looknew);
......@@ -601,7 +603,7 @@ setup_system(void) {
ptr,
MXNAME);
search->origin[MXNAME-1]=0;
ISC_LIST_APPEND
ISC_LIST_APPENDUNSAFE
(search_list,
search,
link);
......@@ -625,7 +627,7 @@ setup_system(void) {
ptr,
MXNAME - 1);
search->origin[MXNAME-1]=0;
ISC_LIST_PREPEND
ISC_LIST_PREPENDUNSAFE
(search_list,
search,
link);
......@@ -1446,6 +1448,7 @@ setup_lookup(dig_lookup_t *lookup) {
query->servname = serv->servername;
query->name_count = 0;
query->rr_count = 0;
ISC_LINK_INIT(query, link);
ISC_LIST_INIT(query->recvlist);
ISC_LIST_INIT(query->lengthlist);
query->sock = NULL;
......
......@@ -17,7 +17,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dnssec-makekeyset.c,v 1.41 2000/09/26 22:11:21 bwelling Exp $ */
/* $Id: dnssec-makekeyset.c,v 1.42 2000/10/20 02:21:34 marka Exp $ */
#include <config.h>
......@@ -275,12 +275,12 @@ main(int argc, char *argv[]) {
if (keynode == NULL)
fatal("out of memory");
keynode->key = zonekey;
ISC_LINK_INIT(keynode, link);
ISC_LIST_APPEND(keylist, keynode, link);
ISC_LIST_APPENDUNSAFE(keylist, keynode, link);
}
rdata = isc_mem_get(mctx, sizeof(dns_rdata_t));
if (rdata == NULL)
fatal("out of memory");
dns_rdata_init(rdata);
data = isc_mem_get(mctx, BUFSIZE);
if (data == NULL)
fatal("out of memory");
......@@ -317,6 +317,7 @@ main(int argc, char *argv[]) {
rdata = isc_mem_get(mctx, sizeof(dns_rdata_t));
if (rdata == NULL)
fatal("out of memory");
dns_rdata_init(rdata);
data = isc_mem_get(mctx, BUFSIZE);
if (data == NULL)
fatal("out of memory");
......
......@@ -17,7 +17,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dnssec-signkey.c,v 1.38 2000/10/17 07:22:21 marka Exp $ */
/* $Id: dnssec-signkey.c,v 1.39 2000/10/20 02:21:35 marka Exp $ */
#include <config.h>
......@@ -117,8 +117,7 @@ loadkeys(dns_name_t *name, dns_rdataset_t *rdataset) {
fatal("out of memory");
keynode->key = key;
keynode->verified = ISC_FALSE;
ISC_LINK_INIT(keynode, link);
ISC_LIST_APPEND(keylist, keynode, link);
ISC_LIST_APPENDUNSAFE(keylist, keynode, link);
}
if (result != ISC_R_NOMORE)
fatal("failure traversing key list");
......@@ -367,9 +366,11 @@ main(int argc, char *argv[]) {
rdata = isc_mem_get(mctx, sizeof(dns_rdata_t));
if (rdata == NULL)
fatal("out of memory");
dns_rdata_init(rdata);
data = isc_mem_get(mctx, BUFSIZE);
if (data == NULL)
fatal("out of memory");
dns_rdata_init(rdata);
isc_buffer_init(&b, data, BUFSIZE);
result = dns_dnssec_sign(domain, &rdataset, key,
&starttime, &endtime,
......
......@@ -17,7 +17,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dnssec-signzone.c,v 1.101 2000/10/17 07:22:22 marka Exp $ */
/* $Id: dnssec-signzone.c,v 1.102 2000/10/20 02:21:36 marka Exp $ */
#include <config.h>
......@@ -1177,7 +1177,7 @@ loadzonekeys(dns_db_t *db) {
key->key = keys[i];
key->isdefault = ISC_FALSE;
key->position = keycount++;
ISC_LIST_APPEND(keylist, key, link);
ISC_LIST_APPENDUNSAFE(keylist, key, link);
}
dns_db_detachnode(db, &node);
dns_db_closeversion(db, &currentversion, ISC_FALSE);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: lwresd.c,v 1.19 2000/10/19 02:55:20 explorer Exp $ */
/* $Id: lwresd.c,v 1.20 2000/10/20 02:21:38 marka Exp $ */
/*
* Main program for the Lightweight Resolver Daemon.
......@@ -480,6 +480,7 @@ add_listener(isc_mem_t *mctx, ns_lwreslistener_t **listenerp,
listener->view = NULL;
listener->manager = NULL;
listener->address = *address;
ISC_LINK_INIT(listener, link);
}
view = NULL;
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: query.c,v 1.138 2000/10/17 20:57:22 mws Exp $ */
/* $Id: query.c,v 1.139 2000/10/20 02:21:39 marka Exp $ */
#include <config.h>
......@@ -165,7 +165,8 @@ query_reset(ns_client_t *client, isc_boolean_t everything) {
dns_db_closeversion(dbversion->db, &dbversion->version,
ISC_FALSE);
dns_db_detach(&dbversion->db);
ISC_LIST_APPEND(client->query.freeversions, dbversion, link);
ISC_LIST_APPENDUNSAFE(client->query.freeversions,
dbversion, link);
}
ISC_LIST_INIT(client->query.activeversions);
......@@ -393,8 +394,8 @@ query_newdbversion(ns_client_t *client, unsigned int n) {
if (dbversion != NULL) {
dbversion->db = NULL;
dbversion->version = NULL;
ISC_LIST_APPEND(client->query.freeversions, dbversion,
link);
ISC_LIST_APPENDUNSAFE(client->query.freeversions,
dbversion, link);
} else {
/*
* We only return ISC_R_NOMEMORY if we couldn't
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: xfrout.c,v 1.76 2000/09/12 18:45:36 explorer Exp $ */
/* $Id: xfrout.c,v 1.77 2000/10/20 02:21:40 marka Exp $ */
#include <config.h>
......@@ -1294,6 +1294,7 @@ sendstream(xfrout_ctx_t *xfr) {
unsigned int size;
isc_region_t r;
dns_rdata_init(&rdata);
xfr->stream->methods->current(xfr->stream,
&name, &ttl, &rdata);
size = name->length + 10 + rdata->length;
......@@ -1348,8 +1349,8 @@ sendstream(xfrout_ctx_t *xfr) {
msgrdl->type = rdata->type;
msgrdl->rdclass = rdata->rdclass;
msgrdl->ttl = ttl;
ISC_LIST_INIT(msgrdl->rdata);
ISC_LINK_INIT(msgrdl, link);
ISC_LIST_INIT(msgrdl->rdata);
ISC_LIST_APPEND(msgrdl->rdata, msgrdata, link);
dns_message_gettemprdataset(msg, &msgrds);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: adb.c,v 1.154 2000/10/07 00:09:18 bwelling Exp $ */
/* $Id: adb.c,v 1.155 2000/10/20 02:21:42 marka Exp $ */
/*
* Implementation notes
......@@ -1634,6 +1634,7 @@ new_adbfetch6(dns_adb_t *adb, dns_adbname_t *name, dns_a6context_t *a6ctx) {
if (a6ctx != NULL)
dns_a6_copy(a6ctx, &f->a6ctx);
ISC_LINK_INIT(f, plink);
f->magic = DNS_ADBFETCH6_MAGIC;
return (f);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: confkeys.c,v 1.28 2000/10/19 01:38:25 bwelling Exp $ */
/* $Id: confkeys.c,v 1.29 2000/10/20 02:21:52 marka Exp $ */
#include <config.h>
......@@ -252,6 +252,7 @@ dns_c_kdef_new(isc_mem_t *mem, const char *name, dns_c_kdef_t **keyid)
kd->algorithm = NULL;
kd->secret = NULL;
ISC_LINK_INIT(kd, next);
*keyid = kd;
......@@ -267,8 +268,8 @@ dns_c_kdef_delete(dns_c_kdef_t **keydef)
REQUIRE(keydef != NULL);
REQUIRE(DNS_C_KDEF_VALID(*keydef));
kd = *keydef;
REQUIRE(!ISC_LINK_LINKED(kd, next));
mem = kd->mem;
......@@ -288,8 +289,6 @@ dns_c_kdef_delete(dns_c_kdef_t **keydef)
kd->algorithm = NULL;
kd->secret = NULL;
ISC_LINK_INIT(kd,next);
isc_mem_put(mem, kd, sizeof *kd);
*keydef = NULL;
......@@ -312,6 +311,7 @@ dns_c_kdef_copy(isc_mem_t *mem,
}
newk->magic = DNS_C_KDEF_MAGIC;
newk->secret = newk->algorithm = newk->keyid = NULL;
ISC_LINK_INIT(newk, next);
newk->keyid = isc_mem_strdup(mem, src->keyid);
if (newk->keyid == NULL) {
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dispatch.c,v 1.71 2000/09/26 22:09:20 bwelling Exp $ */
/* $Id: dispatch.c,v 1.72 2000/10/20 02:21:43 marka Exp $ */
#include <config.h>
......@@ -463,6 +463,8 @@ allocate_event(dns_dispatch_t *disp) {
dns_dispatchevent_t *ev;
ev = isc_mempool_get(disp->mgr->epool);
ISC_EVENT_INIT(ev, sizeof(*ev), 0, NULL, 0,
NULL, NULL, NULL, NULL, NULL);
return (ev);
}
......@@ -1984,8 +1986,7 @@ dns_dispatch_addrequest(dns_dispatch_t *disp,
res->arg = arg;
res->item_out = ISC_FALSE;
ISC_LIST_INIT(res->items);
ISC_LINK_INIT(res, link);
ISC_LIST_APPEND(disp->rq_handlers, res, link);
ISC_LIST_APPENDUNSAFE(disp->rq_handlers, res, link);
request_log(disp, res, LVL(90), "attaching task %p", res->task);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: journal.c,v 1.58 2000/10/18 23:53:22 marka Exp $ */
/* $Id: journal.c,v 1.59 2000/10/20 02:21:44 marka Exp $ */
#include <config.h>
......@@ -209,6 +209,7 @@ dns_difftuple_create(isc_mem_t *mctx,
datap += rdata->length;
ISC_LINK_INIT(&t->rdata, link);
ISC_LINK_INIT(t, link);
t->magic = DNS_DIFFTUPLE_MAGIC;
INSIST(datap == (unsigned char *)t + size);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: master.c,v 1.73 2000/10/17 07:22:30 marka Exp $ */
/* $Id: master.c,v 1.74 2000/10/20 02:21:46 marka Exp $ */
#include <config.h>
......@@ -1284,6 +1284,7 @@ load(dns_loadctx_t **ctxp) {
/*
* Read rdata contents.
*/
dns_rdata_init(&rdata[rdcount]);
result = dns_rdata_fromtext(&rdata[rdcount], ctx->zclass, type,
ctx->lex, ctx->origin, ISC_FALSE, &target,
callbacks);
......@@ -1333,11 +1334,11 @@ load(dns_loadctx_t **ctxp) {
this->rdclass = ctx->zclass;
this->ttl = ctx->ttl;
ISC_LIST_INIT(this->rdata);
ISC_LINK_INIT(this, link);
if (ctx->glue != NULL)
ISC_LIST_PREPEND(glue_list, this, link);
ISC_LIST_PREPENDUNSAFE(glue_list, this, link);
else
ISC_LIST_PREPEND(current_list, this, link);
ISC_LIST_PREPENDUNSAFE(current_list, this,
link);
} else if (this->ttl != ctx->ttl) {
(*callbacks->warn)(callbacks,
"%s: %s:%lu: "
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: message.c,v 1.152 2000/10/12 00:40:48 bwelling Exp $ */
/* $Id: message.c,v 1.153 2000/10/20 02:21:47 marka Exp $ */
/***
*** Imports
......@@ -277,6 +277,7 @@ newrdata(dns_message_t *msg) {
rdata = msgblock_get(msgblock, dns_rdata_t);
}
dns_rdata_init(rdata);
return (rdata);
}
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: nxt.c,v 1.22 2000/10/07 00:09:23 bwelling Exp $ */
/* $Id: nxt.c,v 1.23 2000/10/20 02:21:48 marka Exp $ */
#include <config.h>
......@@ -144,6 +144,7 @@ dns_nxt_build(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node,
dns_rdataset_t rdataset;
dns_rdataset_init(&rdataset);
dns_rdata_init(&rdata);
result = dns_nxt_buildrdata(db, version, node,
target, data, &rdata);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: rbtdb.c,v 1.128 2000/10/18 23:53:23 marka Exp $ */
/* $Id: rbtdb.c,v 1.129 2000/10/20 02:21:49 marka Exp $ */
/*
* Principal Author: Bob Halley
......@@ -501,7 +501,7 @@ add_changed(dns_rbtdb_t *rbtdb, rbtdb_version_t *version,
INSIST(node->references != 0);
changed->node = node;
changed->dirty = ISC_FALSE;
APPEND(version->changed_list, changed, link);
ISC_LIST_APPENDUNSAFE(version->changed_list, changed, link);
} else
version->commit_ok = ISC_FALSE;
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: resolver.c,v 1.172 2000/10/13 18:55:11 halley Exp $ */
/* $Id: resolver.c,v 1.173 2000/10/20 02:21:51 marka Exp $ */
#include <config.h>
......@@ -499,6 +499,7 @@ fctx_sendevents(fetchctx_t *fctx, isc_result_t result) {
event != NULL;
event = next_event) {
next_event = ISC_LIST_NEXT(event, ev_link);
ISC_LIST_UNLINK(fctx->events, event, ev_link);
task = event->ev_sender;
event->ev_sender = fctx;
if (!HAVE_ANSWER(fctx))
......@@ -511,7 +512,6 @@ fctx_sendevents(fetchctx_t *fctx, isc_result_t result) {
isc_task_sendanddetach(&task, (isc_event_t **)&event);
}
ISC_LIST_INIT(fctx->events);
}
static void
......@@ -751,6 +751,7 @@ fctx_query(fetchctx_t *fctx, dns_adbaddrinfo_t *addrinfo,
query->fctx = fctx;
query->tsig = NULL;
query->tsigkey = NULL;
ISC_LINK_INIT(query, link);
query->magic = QUERY_MAGIC;
if ((query->options & DNS_FETCHOPT_TCP) != 0) {
......@@ -1238,8 +1239,7 @@ add_bad(fetchctx_t *fctx, isc_sockaddr_t *address) {
if (sa == NULL)
return;
*sa = *address;
ISC_LINK_INIT(sa, link);
ISC_LIST_APPEND(fctx->bad, sa, link);
ISC_LIST_APPENDUNSAFE(fctx->bad, sa, link);
}
static void
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: lex.c,v 1.38 2000/09/22 18:52:39 bwelling Exp $ */
/* $Id: lex.c,v 1.39 2000/10/20 02:21:53 marka Exp $ */
#include <config.h>
......@@ -208,7 +208,7 @@ new_source(isc_lex_t *lex, isc_boolean_t is_file, isc_boolean_t need_close,
return (ISC_R_NOMEMORY);
}
source->line = 1;
PREPEND(lex->sources, source, link);
ISC_LIST_PREPENDUNSAFE(lex->sources, source, link);
return (ISC_R_SUCCESS);
}
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: log.c,v 1.47 2000/09/26 22:10:22 bwelling Exp $ */
/* $Id: log.c,v 1.48 2000/10/20 02:21:55 marka Exp $ */
/* Principal Authors: DCL */
......@@ -704,6 +704,7 @@ isc_log_createchannel(isc_logconfig_t *lcfg, const char *name,
channel->type = type;
channel->level = level;
channel->flags = flags;
ISC_LINK_INIT(channel, link);
switch (type) {
case ISC_LOG_TOSYSLOG:
......@@ -965,7 +966,7 @@ assignchannel(isc_logconfig_t *lcfg, unsigned int category_id,
new_item->channel = channel;
new_item->module = module;
ISC_LIST_PREPEND(lcfg->channellists[category_id], new_item, link);
ISC_LIST_PREPENDUNSAFE(lcfg->channellists[category_id], new_item, link);
/*
* Remember the highest logging level set by any channel in the
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: mem.c,v 1.64 2000/10/13 05:37:17 marka Exp $ */
/* $Id: mem.c,v 1.65 2000/10/20 02:21:56 marka Exp $ */
#include <config.h>
......@@ -1325,7 +1325,7 @@ isc_mempool_create(isc_mem_t *mctx, size_t size, isc_mempool_t **mpctxp) {
*mpctxp = mpctx;
ISC_LIST_APPEND(mctx->pools, mpctx, link);
ISC_LIST_APPENDUNSAFE(mctx->pools, mpctx, link);
UNLOCK(&mctx->lock);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: symtab.c,v 1.20 2000/08/01 01:29:50 tale Exp $ */
/* $Id: symtab.c,v 1.21 2000/10/20 02:21:57 marka Exp $ */
#include <config.h>
......@@ -215,6 +215,7 @@ isc_symtab_define(isc_symtab_t *symtab, const char *key, unsigned int type,
elt = (elt_t *)isc_mem_get(symtab->mctx, sizeof *elt);
if (elt == NULL)
return (ISC_R_NOMEMORY);
ISC_LINK_INIT(elt, link);
}
/*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment