From: Mark Andrews Date: Mon, 27 Oct 2025 00:07:35 +0000 (+1100) Subject: test-syncplugin.c:plugin_register was broken X-Git-Tag: v9.21.15~34^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=de81887c2a3dbe938e3d9ee54f081620dbaa2f1d;p=thirdparty%2Fbind9.git test-syncplugin.c:plugin_register was broken The variables example2com, example3com, and example4com where not being initalised on all paths leading to Coverity issues ID 637690, ID 637691 and ID 637692 being raised. In addition the tests to free them were wrong as they depended on the unintialised variables. This has been fixed. --- diff --git a/bin/tests/system/hooks/driver/test-syncplugin.c b/bin/tests/system/hooks/driver/test-syncplugin.c index 620829c8cc4..5888e5b541c 100644 --- a/bin/tests/system/hooks/driver/test-syncplugin.c +++ b/bin/tests/system/hooks/driver/test-syncplugin.c @@ -122,9 +122,9 @@ plugin_register(const char *parameters, const void *cfg, const char *cfgfile, ns_hook_t hook; syncplugin_t *inst = NULL; char *sourcestr = NULL; - dns_name_t example2com; - dns_name_t example3com; - dns_name_t example4com; + dns_name_t example2com = DNS_NAME_INITEMPTY; + dns_name_t example3com = DNS_NAME_INITEMPTY; + dns_name_t example4com = DNS_NAME_INITEMPTY; UNUSED(cfg); UNUSED(aclctx); @@ -164,10 +164,6 @@ plugin_register(const char *parameters, const void *cfg, const char *cfgfile, goto cleanup; } - dns_name_init(&example2com); - dns_name_init(&example3com); - dns_name_init(&example4com); - result = dns_name_fromstring(&example2com, "example2.com.", NULL, 0, isc_g_mctx); result = dns_name_fromstring(&example3com, "example3.com.", @@ -201,15 +197,15 @@ plugin_register(const char *parameters, const void *cfg, const char *cfgfile, ns_hook_add(hooktable, mctx, NS_QUERY_NXDOMAIN_BEGIN, &hook); cleanup: - if (DNS_NAME_VALID(&example2com)) { + if (dns_name_dynamic(&example2com)) { dns_name_free(&example2com, isc_g_mctx); } - if (DNS_NAME_VALID(&example3com)) { + if (dns_name_dynamic(&example3com)) { dns_name_free(&example3com, isc_g_mctx); } - if (DNS_NAME_VALID(&example4com)) { + if (dns_name_dynamic(&example4com)) { dns_name_free(&example4com, isc_g_mctx); }