2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 06:55:30 +00:00

2216. [cleanup] Fix a number of errors reported by Coverity.

[RT #17094]
This commit is contained in:
Mark Andrews
2007-08-27 03:32:27 +00:00
parent c60eaaf9b3
commit 557bcc2092
10 changed files with 39 additions and 24 deletions

View File

@@ -1,3 +1,6 @@
2216. [cleanup] Fix a number of errors reported by Coverity.
[RT #17094]
2215. [bug] Bad REQUIRE check isc_hmacsha1_verify(). [RT #17094]
2214. [bug] Deregister OpenSSL lock callback when cleaning

View 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.15 2006/03/09 23:57:56 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.16 2007/08/27 03:32:26 marka Exp $";
#endif
/*
@@ -359,7 +359,7 @@ dst_read_key(const char *in_keyname, const u_int16_t in_id,
pubkey->dk_alg) == 0)
dg_key = dst_free_key(dg_key);
pubkey = dst_free_key(pubkey);
(void)dst_free_key(pubkey);
return (dg_key);
}

View File

@@ -69,7 +69,7 @@ gai_strerror(int ecode) {
goto unknown;
if (!once) {
if (pthread_key_create(&key, free) != 0) {
pthread_mutex_unlock(&lock);
(void)pthread_mutex_unlock(&lock);
goto unknown;
}
once = 1;

View File

@@ -16,7 +16,7 @@
*/
#if !defined(LINT) && !defined(CODECENTER)
static const char rcsid[] = "$Id: irs_data.c,v 1.11 2007/02/25 23:46:58 marka Exp $";
static const char rcsid[] = "$Id: irs_data.c,v 1.12 2007/08/27 03:32:26 marka Exp $";
#endif
#include "port_before.h"
@@ -133,7 +133,7 @@ net_data_init(const char *conf_file) {
return (NULL);
if (!once) {
if (pthread_key_create(&key, net_data_destroy) != 0) {
pthread_mutex_unlock(&keylock);
(void)pthread_mutex_unlock(&keylock);
return (NULL);
}
once = 1;

View File

@@ -16,7 +16,7 @@
*/
#ifndef lint
static const char rcsid[] = "$Id: ns_parse.c,v 1.8 2005/10/11 00:10:15 marka Exp $";
static const char rcsid[] = "$Id: ns_parse.c,v 1.9 2007/08/27 03:32:26 marka Exp $";
#endif
/* Import. */
@@ -40,7 +40,7 @@ static void setsection(ns_msg *msg, ns_sect sect);
/* Macros. */
#ifndef SOLARIS2
#if !defined(SOLARIS2) || defined(__COVERITY__)
#define RETERR(err) do { errno = (err); return (-1); } while (0)
#else
#define RETERR(err) \

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: master.c,v 1.165 2007/06/18 23:47:40 tbox Exp $ */
/* $Id: master.c,v 1.166 2007/08/27 03:32:26 marka Exp $ */
/*! \file */
@@ -2349,7 +2349,6 @@ dns_master_loadfile2(const char *master_file, dns_name_t *top,
INSIST(result != DNS_R_CONTINUE);
cleanup:
if (lctx != NULL)
dns_loadctx_detach(&lctx);
return (result);
}
@@ -2397,7 +2396,6 @@ dns_master_loadfileinc2(const char *master_file, dns_name_t *top,
}
cleanup:
if (lctx != NULL)
dns_loadctx_detach(&lctx);
return (result);
}
@@ -2492,7 +2490,6 @@ dns_master_loadbuffer(isc_buffer_t *buffer, dns_name_t *top,
INSIST(result != DNS_R_CONTINUE);
cleanup:
if (lctx != NULL)
dns_loadctx_detach(&lctx);
return (result);
}
@@ -2529,7 +2526,6 @@ dns_master_loadbufferinc(isc_buffer_t *buffer, dns_name_t *top,
}
cleanup:
if (lctx != NULL)
dns_loadctx_detach(&lctx);
return (result);
}

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: sdb.c,v 1.58 2007/06/18 23:47:41 tbox Exp $ */
/* $Id: sdb.c,v 1.59 2007/08/27 03:32:27 marka Exp $ */
/*! \file */
@@ -121,6 +121,10 @@ typedef struct sdb_rdatasetiter {
/* This is a reasonable value */
#define SDB_DEFAULT_TTL (60 * 60 * 24)
#ifdef __COVERITY__
#define MAYBE_LOCK(sdb) LOCK(&sdb->implementation->driverlock)
#define MAYBE_UNLOCK(sdb) UNLOCK(&sdb->implementation->driverlock)
#else
#define MAYBE_LOCK(sdb) \
do { \
unsigned int flags = sdb->implementation->flags; \
@@ -134,6 +138,7 @@ typedef struct sdb_rdatasetiter {
if ((flags & DNS_SDBFLAG_THREADSAFE) == 0) \
UNLOCK(&sdb->implementation->driverlock); \
} while (0)
#endif
static int dummy;

View File

@@ -50,7 +50,7 @@
* USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: sdlz.c,v 1.13 2007/06/18 23:47:41 tbox Exp $ */
/* $Id: sdlz.c,v 1.14 2007/08/27 03:32:27 marka Exp $ */
/*! \file */
@@ -166,6 +166,10 @@ typedef struct sdlz_rdatasetiter {
static int dummy;
#ifdef __COVERITY__
#define MAYBE_LOCK(imp) LOCK(&imp->driverlock)
#define MAYBE_UNLOCK(imp) UNLOCK(&imp->driverlock)
#else
#define MAYBE_LOCK(imp) \
do { \
unsigned int flags = imp->flags; \
@@ -179,6 +183,7 @@ static int dummy;
if ((flags & DNS_SDLZFLAG_THREADSAFE) == 0) \
UNLOCK(&imp->driverlock); \
} while (0)
#endif
/*
* Forward references. Try to keep these to a minimum.

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zone.c,v 1.465 2007/06/18 23:47:42 tbox Exp $ */
/* $Id: zone.c,v 1.466 2007/08/27 03:32:27 marka Exp $ */
/*! \file */
@@ -5565,7 +5565,6 @@ notify_createmessage(dns_zone_t *zone, unsigned int flags,
REQUIRE(DNS_ZONE_VALID(zone));
REQUIRE(messagep != NULL && *messagep == NULL);
message = NULL;
result = dns_message_create(zone->mctx, DNS_MESSAGE_INTENTRENDER,
&message);
if (result != ISC_R_SUCCESS)
@@ -5692,7 +5691,6 @@ notify_createmessage(dns_zone_t *zone, unsigned int flags,
dns_message_puttempname(message, &tempname);
if (temprdataset != NULL)
dns_message_puttemprdataset(message, &temprdataset);
if (message != NULL)
dns_message_destroy(&message);
return (result);
}

View File

@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: httpd.c,v 1.10 2007/06/18 23:47:44 tbox Exp $ */
/* $Id: httpd.c,v 1.11 2007/08/27 03:32:27 marka Exp $ */
/*! \file */
@@ -257,7 +257,11 @@ isc_httpdmgr_create(isc_mem_t *mctx, isc_socket_t *sock, isc_task_t *task,
if (httpd == NULL)
return (ISC_R_NOMEMORY);
isc_mutex_init(&httpd->lock);
result = isc_mutex_init(&httpd->lock);
if (result != ISC_R_SUCCESS) {
isc_mem_put(mctx, httpd, sizeof(isc_httpdmgr_t));
return (result);
}
httpd->mctx = NULL;
isc_mem_attach(mctx, &httpd->mctx);
httpd->sock = NULL;
@@ -274,6 +278,10 @@ isc_httpdmgr_create(isc_mem_t *mctx, isc_socket_t *sock, isc_task_t *task,
result = isc_socket_accept(sock, task, isc_httpd_accept, httpd);
if (result != ISC_R_SUCCESS) {
isc_task_detach(&httpd->task);
isc_socket_detach(&httpd->sock);
isc_mem_detach(&httpd->mctx);
isc_mutex_destroy(&httpd->lock);
isc_mem_put(mctx, httpd, sizeof(isc_httpdmgr_t));
return (result);
}