]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix several errors reported by Coverity. [RT #17160]
authorEvan Hunt <each@isc.org>
Wed, 26 Sep 2007 04:41:47 +0000 (04:41 +0000)
committerEvan Hunt <each@isc.org>
Wed, 26 Sep 2007 04:41:47 +0000 (04:41 +0000)
CHANGES
lib/bind/dst/dst_api.c
lib/bind/dst/hmac_link.c
lib/dns/tsig.c
lib/lwres/lwres_gnba.c

diff --git a/CHANGES b/CHANGES
index aae686033d3df69d9425ed825b4229c5fab3e943..77c9e8ccbf35e6751f87f19dd26372c165663bf3 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -8,6 +8,8 @@
 2249.   [bug]           Only set Authentic Data bit if client requested
                         DNSSEC, per RFC 3655 [RT #17175]
 
+2248.   [cleanup]       Fix several errors reported by Coverity. [RT #17160]
+
 2245.  [bug]           Validating lack of DS records at trust anchors wasn't
                        working. [RT #17151]
 
index 9404944668ae930fe40967b851e8c0be5517f9fc..6ee3980ebe8ee335848e05533ec2526274cf4608 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef LINT
-static const char rcsid[] = "$Header: /u0/home/explorer/proj/ISC/git-conversion/cvsroot/bind9/lib/bind/dst/Attic/dst_api.c,v 1.10.332.6 2007/08/27 03:34:24 marka Exp $";
+static const char rcsid[] = "$Header: /u0/home/explorer/proj/ISC/git-conversion/cvsroot/bind9/lib/bind/dst/Attic/dst_api.c,v 1.10.332.7 2007/09/26 04:41:47 each Exp $";
 #endif
 
 /*
@@ -434,6 +434,7 @@ dst_s_write_private_key(const DST_KEY *key)
                if ((nn = fwrite(encoded_block, 1, len, fp)) != len) {
                        EREPORT(("dst_write_private_key(): Write failure on %s %d != %d errno=%d\n",
                                 file, len, nn, errno));
+                       fclose(fp);
                        return (-5);
                }
                fclose(fp);
index bf225609f75a03868da3fe675ea60e6238f621b5..5e1dbd45f4055b6cb85c5642ca622f1e347011be 100644 (file)
@@ -1,6 +1,6 @@
 #ifdef HMAC_MD5
 #ifndef LINT
-static const char rcsid[] = "$Header: /u0/home/explorer/proj/ISC/git-conversion/cvsroot/bind9/lib/bind/dst/Attic/hmac_link.c,v 1.3.164.4 2007/02/26 02:00:24 marka Exp $";
+static const char rcsid[] = "$Header: /u0/home/explorer/proj/ISC/git-conversion/cvsroot/bind9/lib/bind/dst/Attic/hmac_link.c,v 1.3.164.5 2007/09/26 04:41:47 each Exp $";
 #endif
 /*
  * Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
@@ -223,6 +223,7 @@ dst_buffer_to_hmac_md5(DST_KEY *dkey, const u_char *key, const int keylen)
        HMAC_Key *hkey = NULL;
        MD5_CTX ctx;
        int local_keylen = keylen;
+       u_char tk[MD5_LEN];
 
        if (dkey == NULL || key == NULL || keylen < 0)
                return (-1);
@@ -235,7 +236,6 @@ dst_buffer_to_hmac_md5(DST_KEY *dkey, const u_char *key, const int keylen)
 
        /* if key is longer than HMAC_LEN bytes reset it to key=MD5(key) */
        if (keylen > HMAC_LEN) {
-               u_char tk[MD5_LEN];
                MD5Init(&ctx);
                MD5Update(&ctx, key, keylen);
                MD5Final(tk, &ctx);
index c5107b54c351636545e7eed16f01e892cf35348b..29dc0d7f5b71acae57193cee3fee5923e5ecde0c 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 /*
- * $Id: tsig.c,v 1.117.18.9 2006/05/02 04:23:12 marka Exp $
+ * $Id: tsig.c,v 1.117.18.10 2007/09/26 04:41:47 each Exp $
  */
 /*! \file */
 #include <config.h>
@@ -1429,8 +1429,10 @@ dns_tsigkeyring_create(isc_mem_t *mctx, dns_tsig_keyring_t **ringp) {
                return (ISC_R_NOMEMORY);
 
        result = isc_rwlock_init(&ring->lock, 0, 0);
-       if (result != ISC_R_SUCCESS)
+       if (result != ISC_R_SUCCESS) {
+               isc_mem_put(mctx, ring, sizeof(dns_tsig_keyring_t));
                return (result);
+       }
 
        ring->keys = NULL;
        result = dns_rbt_create(mctx, free_tsignode, NULL, &ring->keys);
index 5f4164873f74db3a061b037b482a389dd5ae9b0d..6f4bcf1885de89d3a993b6531b47e859a19a75c2 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: lwres_gnba.c,v 1.23.18.2 2005/04/29 00:17:20 marka Exp $ */
+/* $Id: lwres_gnba.c,v 1.23.18.3 2007/09/26 04:41:47 each Exp $ */
 
 /*! \file lwres_gnba.c
    These are low-level routines for creating and parsing lightweight
@@ -126,7 +126,6 @@ lwres_gnbarequest_render(lwres_context_t *ctx, lwres_gnbarequest_t *req,
        REQUIRE(req != NULL);
        REQUIRE(req->addr.family != 0);
        REQUIRE(req->addr.length != 0);
-       REQUIRE(req->addr.address != NULL);
        REQUIRE(pkt != NULL);
        REQUIRE(b != NULL);