Commit f2762b0d authored by Michael Graff's avatar Michael Graff
Browse files

check for more things with INSIST()

parent 270bb3aa
...@@ -333,6 +333,7 @@ msgresetnames(dns_message_t *msg, unsigned int first_section) { ...@@ -333,6 +333,7 @@ msgresetnames(dns_message_t *msg, unsigned int first_section) {
next_rds = ISC_LIST_NEXT(rds, link); next_rds = ISC_LIST_NEXT(rds, link);
ISC_LIST_UNLINK(name->list, rds, link); ISC_LIST_UNLINK(name->list, rds, link);
INSIST(dns_rdataset_isassociated(rds));
dns_rdataset_disassociate(rds); dns_rdataset_disassociate(rds);
isc_mempool_put(msg->rdspool, rds); isc_mempool_put(msg->rdspool, rds);
rds = next_rds; rds = next_rds;
...@@ -358,6 +359,7 @@ msgreset(dns_message_t *msg, isc_boolean_t everything) ...@@ -358,6 +359,7 @@ msgreset(dns_message_t *msg, isc_boolean_t everything)
msgresetnames(msg, 0); msgresetnames(msg, 0);
if (msg->opt != NULL) { if (msg->opt != NULL) {
INSIST(dns_rdataset_isassociated(msg->opt));
dns_rdataset_disassociate(msg->opt); dns_rdataset_disassociate(msg->opt);
isc_mempool_put(msg->rdspool, msg->opt); isc_mempool_put(msg->rdspool, msg->opt);
msg->opt = NULL; msg->opt = NULL;
...@@ -893,8 +895,10 @@ getquestions(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx) ...@@ -893,8 +895,10 @@ getquestions(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx)
return (DNS_R_SUCCESS); return (DNS_R_SUCCESS);
cleanup: cleanup:
if (rdataset != NULL) if (rdataset != NULL) {
INSIST(!dns_rdataset_isassociated(rdataset));
isc_mempool_put(msg->rdspool, rdataset); isc_mempool_put(msg->rdspool, rdataset);
}
#if 0 #if 0
if (rdatalist != NULL) if (rdatalist != NULL)
isc_mempool_put(msg->rdlpool, rdatalist); isc_mempool_put(msg->rdlpool, rdatalist);
...@@ -1792,6 +1796,7 @@ dns_message_puttemprdataset(dns_message_t *msg, dns_rdataset_t **item) ...@@ -1792,6 +1796,7 @@ dns_message_puttemprdataset(dns_message_t *msg, dns_rdataset_t **item)
REQUIRE(DNS_MESSAGE_VALID(msg)); REQUIRE(DNS_MESSAGE_VALID(msg));
REQUIRE(item != NULL && *item != NULL); REQUIRE(item != NULL && *item != NULL);
REQUIRE(!dns_rdataset_isassociated(*item));
isc_mempool_put(msg->rdspool, *item); isc_mempool_put(msg->rdspool, *item);
*item = NULL; *item = NULL;
} }
...@@ -1924,6 +1929,7 @@ dns_message_setopt(dns_message_t *msg, dns_rdataset_t *opt) { ...@@ -1924,6 +1929,7 @@ dns_message_setopt(dns_message_t *msg, dns_rdataset_t *opt) {
return (result); return (result);
dns_rdataset_current(msg->opt, &rdata); dns_rdataset_current(msg->opt, &rdata);
result = dns_message_renderrelease(msg, 11 + rdata.length); result = dns_message_renderrelease(msg, 11 + rdata.length);
INSIST(dns_rdataset_isassociated(msg->opt));
dns_rdataset_disassociate(msg->opt); dns_rdataset_disassociate(msg->opt);
isc_mempool_put(msg->rdspool, msg->opt); isc_mempool_put(msg->rdspool, msg->opt);
msg->opt = NULL; msg->opt = NULL;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment