]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Workaround compiler bug that optimizes setting .free_pools
authorOndřej Surý <ondrej@isc.org>
Tue, 26 Sep 2023 12:29:54 +0000 (14:29 +0200)
committerOndřej Surý <ondrej@isc.org>
Tue, 26 Sep 2023 12:59:39 +0000 (14:59 +0200)
The .free_pools bitfield would not be set on some levels of
optimizations - workaround the compiler bug by reordering the setting
the .freepools in the initializer.

lib/dns/message.c

index 7f8ffc76d1466e5513fe98217df4ef6498d5c7fa..5ec09c6f7da303da418ba9990ed1643ae4e54f8a 100644 (file)
@@ -725,13 +725,13 @@ dns_message_create(isc_mem_t *mctx, isc_mempool_t *namepool,
                .magic = DNS_MESSAGE_MAGIC,
                .namepool = namepool,
                .rdspool = rdspool,
+               .free_pools = (namepool == NULL && rdspool == NULL),
        };
 
        isc_mem_attach(mctx, &msg->mctx);
 
-       if (namepool == NULL && rdspool == NULL) {
+       if (msg->free_pools) {
                dns_message_createpools(mctx, &msg->namepool, &msg->rdspool);
-               msg->free_pools = true;
        }
 
        msginit(msg);