Coverity Scan issues after DNSRPS test library integration
With the DNSRPS test library integrated (!7693 (merged)) Coverity Scan reported two issues.
*** CID 451099: (RESOURCE_LEAK)
/lib/dns/include/dns/librpz.h: 918 in librpz_lib_open()
912 }
913 new_librpz = dlsym(handle, LIBRPZ_DEF_STR);
914 if (new_librpz != NULL) {
915 if (dl_handle != NULL) {
916 *dl_handle = handle;
917 }
>>> CID 451099: (RESOURCE_LEAK)
>>> Variable "handle" going out of scope leaks the storage it points to.
918 return (new_librpz);
919 }
920 snprintf(emsg->c, sizeof(librpz_emsg_t),
921 "dlsym(%s, " LIBRPZ_DEF_STR "): %s", path, dlerror());
922 dlclose(handle);
923 return (NULL);
/lib/dns/include/dns/librpz.h: 891 in librpz_lib_open()
885 if (handle != NULL) {
886 new_librpz = dlsym(handle, LIBRPZ_DEF_STR);
887 if (new_librpz != NULL) {
888 if (dl_handle != NULL) {
889 *dl_handle = handle;
890 }
>>> CID 451099: (RESOURCE_LEAK)
>>> Variable "handle" going out of scope leaks the storage it points to.
891 return (new_librpz);
892 }
893 if (dlclose(handle) != 0) {
894 snprintf(emsg->c, sizeof(librpz_emsg_t),
895 "dlsym(NULL, " LIBRPZ_DEF_STR "): %s",
896 dlerror());
*** CID 451096: Error handling issues (CHECKED_RETURN)
/lib/ns/query.c: 3442 in dnsrps_set_p()
3436 return (false);
3437 }
3438 region.base = pname_buf.d;
3439 region.length = pname_buf.size;
3440 dns_name_fromregion(st->p_name, ®ion);
3441
>>> CID 451096: Error handling issues (CHECKED_RETURN)
>>> Calling "rpz_ready" without checking return value (as is done elsewhere 4 out of 5 times).
3442 rpz_ready(client, p_rdatasetp);
3443 dns_db_attach(st->rpsdb, &p_db);
3444 policy = dns_dnsrps_2policy(rpsdb->result.policy);
3445 if (policy != DNS_RPZ_POLICY_RECORD) {
3446 result = ISC_R_SUCCESS;
3447 } else if (qtype == dns_rdatatype_rrsig) {