[master] fixed some test failures

This commit is contained in:
Evan Hunt 2016-05-26 21:29:54 -07:00
parent 7dbcb6fb90
commit 531074d11a
2 changed files with 13 additions and 8 deletions

View 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;

View 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);
}