]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[master] fixed some test failures
authorEvan Hunt <each@isc.org>
Fri, 27 May 2016 04:29:54 +0000 (21:29 -0700)
committerEvan Hunt <each@isc.org>
Fri, 27 May 2016 04:29:54 +0000 (21:29 -0700)
lib/dns/ipkeylist.c
lib/isc/buffer.c

index c70c1dc837ac249dac3d24a47f27d7f92f40b12d..fef2925eeb73244764071a2c0dcdd81d72c82d0b 100644 (file)
@@ -30,16 +30,19 @@ dns_ipkeylist_clear(isc_mem_t *mctx, dns_ipkeylist_t *ipkl) {
        isc_uint32_t i;
 
        REQUIRE(ipkl != NULL);
-       REQUIRE(ipkl->addrs != NULL);
-       REQUIRE(ipkl->keys != NULL);
+       REQUIRE(ipkl->count == 0 || ipkl->keys != NULL);
 
        if (ipkl->count == 0)
                return;
 
-       isc_mem_put(mctx, ipkl->addrs, ipkl->count * sizeof(isc_sockaddr_t));
+       if (ipkl != NULL)
+               isc_mem_put(mctx, ipkl->addrs,
+                           ipkl->count * sizeof(isc_sockaddr_t));
+
        if (ipkl->dscps != NULL)
                isc_mem_put(mctx, ipkl->dscps,
                            ipkl->count * sizeof(isc_dscp_t));
+
        for (i = 0; i < ipkl->count; i++) {
                if (ipkl->keys[i] == NULL)
                        continue;
@@ -47,7 +50,9 @@ dns_ipkeylist_clear(isc_mem_t *mctx, dns_ipkeylist_t *ipkl) {
                        dns_name_free(ipkl->keys[i], mctx);
                isc_mem_put(mctx, ipkl->keys[i], sizeof(dns_name_t));
        }
+
        isc_mem_put(mctx, ipkl->keys, ipkl->count * sizeof(dns_name_t *));
+
        ipkl->count = 0;
        ipkl->addrs = NULL;
        ipkl->dscps = NULL;
index 8eb75e9b36021175856dee1b2176d4d80c88fd74..c8cbdd5a5dae0a224c21291d8c5dc3b28eb53713 100644 (file)
@@ -60,7 +60,7 @@ isc_buffer_reinit(isc_buffer_t *b, void *base, unsigned int length) {
         */
        REQUIRE(b->length <= length);
        REQUIRE(base != NULL);
-       REQUIRE(b->autore = ISC_FALSE);
+       REQUIRE(!b->autore);
 
        (void)memmove(base, b->base, b->length);
        b->base = base;
@@ -372,7 +372,7 @@ void
 isc__buffer_putuint32(isc_buffer_t *b, isc_uint32_t val) {
        isc_result_t result;
        REQUIRE(ISC_BUFFER_VALID(b));
-       if (b->autore == ISC_TRUE) {
+       if (b->autore) {
                result = isc_buffer_reserve(&b, 4);
                REQUIRE(result == ISC_R_SUCCESS);
        }
@@ -413,7 +413,7 @@ isc__buffer_putuint48(isc_buffer_t *b, isc_uint64_t val) {
        isc_uint32_t vallo;
 
        REQUIRE(ISC_BUFFER_VALID(b));
-       if (b->autore == ISC_TRUE) {
+       if (b->autore) {
                result = isc_buffer_reserve(&b, 6);
                REQUIRE(result == ISC_R_SUCCESS);
        }
@@ -431,7 +431,7 @@ isc__buffer_putmem(isc_buffer_t *b, const unsigned char *base,
 {
        isc_result_t result;
        REQUIRE(ISC_BUFFER_VALID(b));
-       if (b->autore == ISC_TRUE) {
+       if (b->autore) {
                result = isc_buffer_reserve(&b, length);
                REQUIRE(result == ISC_R_SUCCESS);
        }
@@ -453,7 +453,7 @@ isc__buffer_putstr(isc_buffer_t *b, const char *source) {
         * Do not use ISC__BUFFER_PUTSTR(), so strlen is only done once.
         */
        l = strlen(source);
-       if (b->autore == ISC_TRUE) {
+       if (b->autore) {
                result = isc_buffer_reserve(&b, l);
                REQUIRE(result == ISC_R_SUCCESS);
        }