2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00

address memory leak in change #3662, force format matching, attempt to address coverity false positives

This commit is contained in:
Mark Andrews
2013-10-26 10:04:36 +11:00
parent 7aa21a491d
commit 938aea1dc4
3 changed files with 12 additions and 7 deletions

View File

@@ -543,8 +543,8 @@ debug(const char *format, ...) {
if (debugtiming) { if (debugtiming) {
struct timeval tv; struct timeval tv;
(void)gettimeofday(&tv, NULL); (void)gettimeofday(&tv, NULL);
fprintf(stderr, "%ld.%06d: ", (long)tv.tv_sec, fprintf(stderr, "%ld.%06ld: ", (long)tv.tv_sec,
tv.tv_usec); (long)tv.tv_usec);
} }
va_start(args, format); va_start(args, format);
vfprintf(stderr, format, args); vfprintf(stderr, format, args);
@@ -2829,11 +2829,13 @@ launch_next_query(dig_query_t *query, isc_boolean_t include_question) {
isc_buffer_putuint16(&query->slbuf, (isc_uint16_t) query->sendbuf.used); isc_buffer_putuint16(&query->slbuf, (isc_uint16_t) query->sendbuf.used);
ISC_LIST_INIT(query->sendlist); ISC_LIST_INIT(query->sendlist);
ISC_LINK_INIT(&query->slbuf, link); ISC_LINK_INIT(&query->slbuf, link);
buffer = clone_buffer(&query->slbuf); if (!query->first_soa_rcvd) {
ISC_LIST_ENQUEUE(query->sendlist, buffer, link); buffer = clone_buffer(&query->slbuf);
if (include_question) {
buffer = clone_buffer(&query->sendbuf);
ISC_LIST_ENQUEUE(query->sendlist, buffer, link); ISC_LIST_ENQUEUE(query->sendlist, buffer, link);
if (include_question) {
buffer = clone_buffer(&query->sendbuf);
ISC_LIST_ENQUEUE(query->sendlist, buffer, link);
}
} }
ISC_LINK_INIT(&query->lengthbuf, link); ISC_LINK_INIT(&query->lengthbuf, link);

View File

@@ -127,7 +127,7 @@ fromstruct_isdn(ARGS_FROMSTRUCT) {
RETERR(uint8_tobuffer(isdn->isdn_len, target)); RETERR(uint8_tobuffer(isdn->isdn_len, target));
RETERR(mem_tobuffer(target, isdn->isdn, isdn->isdn_len)); RETERR(mem_tobuffer(target, isdn->isdn, isdn->isdn_len));
if (isdn->subaddress == NULL && isdn->subaddress_len == 0) if (isdn->subaddress == NULL)
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
RETERR(uint8_tobuffer(isdn->subaddress_len, target)); RETERR(uint8_tobuffer(isdn->subaddress_len, target));
return (mem_tobuffer(target, isdn->subaddress, isdn->subaddress_len)); return (mem_tobuffer(target, isdn->subaddress, isdn->subaddress_len));

View File

@@ -9279,6 +9279,7 @@ dns_zone_markdirty(dns_zone_t *zone) {
if (inline_raw(zone)) { if (inline_raw(zone)) {
unsigned int soacount; unsigned int soacount;
secure = zone->secure; secure = zone->secure;
INSIST(secure != zone);
TRYLOCK_ZONE(result, secure); TRYLOCK_ZONE(result, secure);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
UNLOCK_ZONE(zone); UNLOCK_ZONE(zone);
@@ -13566,6 +13567,7 @@ dns_zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump) {
LOCK_ZONE(zone); LOCK_ZONE(zone);
if (inline_raw(zone)) { if (inline_raw(zone)) {
secure = zone->secure; secure = zone->secure;
INSIST(secure != zone);
TRYLOCK_ZONE(result, secure); TRYLOCK_ZONE(result, secure);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
UNLOCK_ZONE(zone); UNLOCK_ZONE(zone);
@@ -13826,6 +13828,7 @@ zone_xfrdone(dns_zone_t *zone, isc_result_t result) {
LOCK_ZONE(zone); LOCK_ZONE(zone);
if (inline_raw(zone)) { if (inline_raw(zone)) {
secure = zone->secure; secure = zone->secure;
INSIST(secure != zone);
TRYLOCK_ZONE(result, secure); TRYLOCK_ZONE(result, secure);
if (result != ISC_R_SUCCESS) { if (result != ISC_R_SUCCESS) {
UNLOCK_ZONE(zone); UNLOCK_ZONE(zone);