Commit cfcb0881 authored by Mark Andrews's avatar Mark Andrews
Browse files

2111. [bug] Fix a number of errors reported by Coverity.

                        [RT #16507]
parent 1a8efeab
2111. [bug] Fix a number of errors reported by Coverity.
[RT #16507]
2110. [bug] "minimal-response yes;" interacted badly with BIND 8
priming queries. [RT #16491]
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: controlconf.c,v 1.50 2006/02/28 02:39:51 marka Exp $ */
/* $Id: controlconf.c,v 1.51 2006/12/07 04:46:27 marka Exp $ */
/*! \file */
......@@ -690,7 +690,7 @@ controlkeylist_fromcfg(const cfg_obj_t *keylist, isc_mem_t *mctx,
char *newstr = NULL;
const char *str;
const cfg_obj_t *obj;
controlkey_t *key = NULL;
controlkey_t *key;
for (element = cfg_list_first(keylist);
element != NULL;
......@@ -709,7 +709,6 @@ controlkeylist_fromcfg(const cfg_obj_t *keylist, isc_mem_t *mctx,
key->secret.length = 0;
ISC_LINK_INIT(key, link);
ISC_LIST_APPEND(*keyids, key, link);
key = NULL;
newstr = NULL;
}
return (ISC_R_SUCCESS);
......@@ -717,8 +716,6 @@ controlkeylist_fromcfg(const cfg_obj_t *keylist, isc_mem_t *mctx,
cleanup:
if (newstr != NULL)
isc_mem_free(mctx, newstr);
if (key != NULL)
isc_mem_put(mctx, key, sizeof(*key));
free_controlkeylist(keyids, mctx);
return (ISC_R_NOMEMORY);
}
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: lwdgrbn.c,v 1.16 2005/11/30 03:33:48 marka Exp $ */
/* $Id: lwdgrbn.c,v 1.17 2006/12/07 04:46:27 marka Exp $ */
/*! \file */
......@@ -185,8 +185,6 @@ iterate_node(lwres_grbnresponse_t *grbn, dns_db_t *db, dns_dbnode_t *node,
isc_mem_put(mctx, oldlens, oldsize * sizeof(*oldlens));
if (newrdatas != NULL)
isc_mem_put(mctx, newrdatas, used * sizeof(*oldrdatas));
if (newlens != NULL)
isc_mem_put(mctx, newlens, used * sizeof(*oldlens));
return (result);
}
......
......@@ -16,7 +16,7 @@
*/
#if !defined(LINT) && !defined(CODECENTER)
static const char rcsid[] = "$Id: irp_ng.c,v 1.3 2005/04/27 04:56:28 sra Exp $";
static const char rcsid[] = "$Id: irp_ng.c,v 1.4 2006/12/07 04:46:27 marka Exp $";
#endif
/* Imports */
......@@ -218,14 +218,14 @@ ng_test(struct irs_ng *this, const char *name,
}
if (irs_irp_send_command(pvt->girpdata, "innetgr %s", body) == 0) {
memput(body, bodylen);
code = irs_irp_read_response(pvt->girpdata, text, sizeof text);
if (code == IRPD_GETNETGR_MATCHES) {
rval = 1;
}
}
memput(body, bodylen);
return (rval);
}
......
#if !defined(lint) && !defined(SABER)
static const char rcsid[] = "$Id: ctl_srvr.c,v 1.7 2005/04/27 04:56:35 sra Exp $";
static const char rcsid[] = "$Id: ctl_srvr.c,v 1.8 2006/12/07 04:46:27 marka Exp $";
#endif /* not lint */
/*
......@@ -564,7 +564,7 @@ static void
ctl_readable(evContext lev, void *uap, int fd, int evmask) {
static const char me[] = "ctl_readable";
struct ctl_sess *sess = uap;
struct ctl_sctx *ctx = sess->ctx;
struct ctl_sctx *ctx;
char *eos, tmp[MAX_NTOP];
ssize_t n;
......@@ -572,6 +572,8 @@ ctl_readable(evContext lev, void *uap, int fd, int evmask) {
REQUIRE(fd >= 0);
REQUIRE(evmask == EV_READ);
REQUIRE(sess->state == reading || sess->state == reading_data);
ctx = sess->ctx;
evTouchIdleTimer(lev, sess->rdtiID);
if (!allocated_p(sess->inbuf) &&
ctl_bufget(&sess->inbuf, ctx->logger) < 0) {
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: master.c,v 1.159 2005/11/30 03:33:49 marka Exp $ */
/* $Id: master.c,v 1.160 2006/12/07 04:46:27 marka Exp $ */
/*! \file */
......@@ -1215,6 +1215,7 @@ load_text(dns_loadctx_t *lctx) {
isc_mem_free(mctx, gtype);
if (rhs != NULL)
isc_mem_free(mctx, rhs);
range = lhs = gtype = rhs = NULL;
/* RANGE */
GETTOKEN(lctx->lex, 0, &token, ISC_FALSE);
range = isc_mem_strdup(mctx,
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: sdb.c,v 1.53 2005/10/13 01:58:32 marka Exp $ */
/* $Id: sdb.c,v 1.54 2006/12/07 04:46:27 marka Exp $ */
/*! \file */
......@@ -935,7 +935,8 @@ find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version,
xresult = dns_name_copy(xname, foundname, NULL);
if (xresult != ISC_R_SUCCESS) {
destroynode(node);
if (node != NULL)
destroynode(node);
if (dns_rdataset_isassociated(rdataset))
dns_rdataset_disassociate(rdataset);
return (DNS_R_BADDB);
......
......@@ -50,7 +50,7 @@
* USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: sdlz.c,v 1.7 2005/11/30 03:33:49 marka Exp $ */
/* $Id: sdlz.c,v 1.8 2006/12/07 04:46:27 marka Exp $ */
/*! \file */
......@@ -894,7 +894,8 @@ find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version,
xresult = dns_name_copy(xname, foundname, NULL);
if (xresult != ISC_R_SUCCESS) {
destroynode(node);
if (node != NULL)
destroynode(node);
if (dns_rdataset_isassociated(rdataset))
dns_rdataset_disassociate(rdataset);
return (DNS_R_BADDB);
......
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: entropy.c,v 1.77 2006/03/02 23:25:05 marka Exp $ */
/* $Id: entropy.c,v 1.78 2006/12/07 04:46:27 marka Exp $ */
/* \file unix/entropy.c
* \brief
......@@ -487,8 +487,6 @@ isc_entropy_createfilesource(isc_entropy_t *ent, const char *fname) {
LOCK(&ent->lock);
source = NULL;
if (stat(fname, &_stat) < 0) {
ret = isc__errno2result(errno);
goto errout;
......@@ -590,9 +588,6 @@ isc_entropy_createfilesource(isc_entropy_t *ent, const char *fname) {
(void)close(fd);
errout:
if (source != NULL)
isc_mem_put(ent->mctx, source, sizeof(isc_entropysource_t));
UNLOCK(&ent->lock);
return (ret);
......
......@@ -16,7 +16,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: cc.c,v 1.13 2005/04/29 00:23:55 marka Exp $ */
/* $Id: cc.c,v 1.14 2006/12/07 04:46:27 marka Exp $ */
/*! \file */
......@@ -468,12 +468,21 @@ createmessage(isc_uint32_t version, const char *from, const char *to,
result = ISC_R_NOMEMORY;
_ctrl = isccc_alist_create();
if (_ctrl == NULL)
goto bad;
if (isccc_alist_define(alist, "_ctrl", _ctrl) == NULL) {
isccc_sexpr_free(&_ctrl);
goto bad;
}
_data = isccc_alist_create();
if (_ctrl == NULL || _data == NULL)
if (_data == NULL)
goto bad;
if (isccc_alist_define(alist, "_ctrl", _ctrl) == NULL ||
isccc_alist_define(alist, "_data", _data) == NULL)
if (isccc_alist_define(alist, "_data", _data) == NULL) {
isccc_sexpr_free(&_data);
goto bad;
}
if (isccc_cc_defineuint32(_ctrl, "_ser", serial) == NULL ||
isccc_cc_defineuint32(_ctrl, "_tim", now) == NULL ||
(want_expires &&
......
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