]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
2111. [bug] Fix a number of errors reported by Coverity.
authorMark Andrews <marka@isc.org>
Thu, 7 Dec 2006 04:53:03 +0000 (04:53 +0000)
committerMark Andrews <marka@isc.org>
Thu, 7 Dec 2006 04:53:03 +0000 (04:53 +0000)
                        [RT #16507]

CHANGES
bin/named/controlconf.c
bin/named/lwdgrbn.c
lib/bind/irs/irp_ng.c
lib/bind/isc/ctl_srvr.c
lib/dns/master.c
lib/dns/sdb.c
lib/dns/sdlz.c
lib/isc/unix/entropy.c
lib/isccc/cc.c

diff --git a/CHANGES b/CHANGES
index 2595e0a7d2e24842c42ce7f0d10c17197d184459..44112d37f08a6b5e06c8033711916148d1333f9c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+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]
 
index 6eb0a0a93ed189300e8ba2fde1c8bf3401a516a8..3e364469e6d3e794a1fe2889e86a7a817b11312e 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: controlconf.c,v 1.40.18.9 2006/02/28 03:10:47 marka Exp $ */
+/* $Id: controlconf.c,v 1.40.18.10 2006/12/07 04:53:02 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);
 }
index a73f2403903f758bb80f338857095daf5e5c761c..5f7bc5d8ea343d5e7b35ef5f9919fb73fc6f1b8f 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: lwdgrbn.c,v 1.13.18.3 2005/11/30 03:44:38 marka Exp $ */
+/* $Id: lwdgrbn.c,v 1.13.18.4 2006/12/07 04:53:02 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);
 }
 
index 7596329f00e7abadd650ed5cd12ae2b4463a95e8..e0aa46832ff30b38e325a65bd721340122eb4119 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 #if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: irp_ng.c,v 1.2.18.1 2005/04/27 05:01:00 sra Exp $";
+static const char rcsid[] = "$Id: irp_ng.c,v 1.2.18.2 2006/12/07 04:53:02 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);
 }
 
index d1ef235cfcd6adecd9670538c5906fbd79979565..52137c077d36eebd0c6af98dc8d287f65834a6f2 100644 (file)
@@ -1,5 +1,5 @@
 #if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: ctl_srvr.c,v 1.6.18.1 2005/04/27 05:01:06 sra Exp $";
+static const char rcsid[] = "$Id: ctl_srvr.c,v 1.6.18.2 2006/12/07 04:53:02 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) {
index 82364f4aa43ceeb15d473a172509b5b3e0a4869f..68eccf749e21c3af9dc447e04aff5563b2cbbb8e 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: master.c,v 1.148.18.11 2005/11/30 03:44:39 marka Exp $ */
+/* $Id: master.c,v 1.148.18.12 2006/12/07 04:53:02 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,
index 1724256d794b8ba82883c6c758a59b754814e597..0071d7a36c7a007efe47235239da503b2301a38b 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: sdb.c,v 1.45.18.8 2005/10/13 02:12:25 marka Exp $ */
+/* $Id: sdb.c,v 1.45.18.9 2006/12/07 04:53:02 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);
index 88273a38d0d66622cc0afb0d006af5b537080878..77dd7d94ff48cc9292b830d91e888228b83707af 100644 (file)
@@ -50,7 +50,7 @@
  * USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: sdlz.c,v 1.2.2.5 2005/11/30 03:44:39 marka Exp $ */
+/* $Id: sdlz.c,v 1.2.2.6 2006/12/07 04:53:02 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);
index acbaebb7cdda00ee4295d1b59f64ca56c85f59e2..4c0d0d0cb9ff1bdd87aee30045f1317f41aac02f 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: entropy.c,v 1.71.18.6 2006/03/02 23:29:24 marka Exp $ */
+/* $Id: entropy.c,v 1.71.18.7 2006/12/07 04:53:03 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);
index 74d3a7bfcc71a3deb5265b64eab747d4941b652a..eadbfcc7172972b880cc4a98681666898fefab5d 100644 (file)
@@ -16,7 +16,7 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: cc.c,v 1.10.18.3 2005/04/29 00:17:11 marka Exp $ */
+/* $Id: cc.c,v 1.10.18.4 2006/12/07 04:53:03 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 &&