]> 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:46:27 +0000 (04:46 +0000)
committerMark Andrews <marka@isc.org>
Thu, 7 Dec 2006 04:46:27 +0000 (04:46 +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 09bc725d0323b125a0d9c5ac08ac184fc275a241..e50b54e808e0d4e436a266ae310a9c19a0a2a374 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 65ad781f347c7009caeac64e5bd7629363d4a507..d8af88e0fefa58278b933b372ed1edf9416b705d 100644 (file)
@@ -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);
 }
index 490a03baa18dbe65592a8ac755678939705a516d..6f992b85174cb0dcb96a963eab32797896779d14 100644 (file)
@@ -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);
 }
 
index 02a957adf04b68cbcd39c476eddafcd60ded1cea..1af862cab434124a9337688f8a3059e403f98505 100644 (file)
@@ -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);
 }
 
index 1bf48938044bc943ea938d3558a86366e330e060..836b85a8df84b6738f6b5ba336d8979dfdda5cfa 100644 (file)
@@ -1,5 +1,5 @@
 #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) {
index df7cb8733b3fee6d51d5827015190c075eb2104f..e87241e5571f0a6c81be11a8d0407ec650376cf0 100644 (file)
@@ -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,
index 29ca214496b81f3eafc13547df02c96f602d49ba..a328cd4667e0dfcb74cc4035b63d2cc24d57bdbb 100644 (file)
@@ -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);
index ee60ef21c8c2dd2de5c5a96f91cebf8e9b2c952b..777f77ee78a328b1f4ff2c964123d0a97e21ed5f 100644 (file)
@@ -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);
index e3a3a201f43b97dd989c789f1a7e2d20759276ab..e1bb16a76bea712c58648861a01a1422efe1906d 100644 (file)
@@ -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);
index 273c9221abfbd003a518e0bef51d1078f730d257..040d474b4b21c0c084d76043031119640bfdd4bc 100644 (file)
@@ -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 &&