Address reports by Coverity in updated OpenSSL code !5385
** CID 340808: Control flow issues (DEADCODE)
/lib/dns/openssldh_link.c: 1209 in openssldh_parse()
________________________________________________________________________________________________________
*** CID 340808: Control flow issues (DEADCODE)
/lib/dns/openssldh_link.c: 1209 in openssldh_parse()
1203 key->key_size = (unsigned int)key_size;
1204 ret = ISC_R_SUCCESS;
1205
1206 err:
1207 #if OPENSSL_VERSION_NUMBER < 0x30000000L
1208 if (dh != NULL) {
CID 340808: Control flow issues (DEADCODE)
Execution cannot reach this statement: "DH_free(dh);".
1209 DH_free(dh);
1210 }
1211 #else
1212 if (pkey != NULL) {
1213 EVP_PKEY_free(pkey);
1214 }
** CID 340807: (OVERRUN)
/lib/dns/opensslrsa_link.c: 931 in opensslrsa_tofile()
/lib/dns/opensslrsa_link.c: 930 in opensslrsa_tofile()
/lib/dns/opensslrsa_link.c: 931 in opensslrsa_tofile()
________________________________________________________________________________________________________
*** CID 340807: (OVERRUN)
/lib/dns/opensslrsa_link.c: 931 in opensslrsa_tofile()
925 priv.nelements = i;
926 ret = dst__privstruct_writefile(key, &priv, directory);
927
928 err:
929 while (i--) {
930 if (bufs[i] != NULL) {
CID 340807: (OVERRUN)
Overrunning array "bufs" of 8 8-byte elements at element index 9 (byte offset 79) using index "i" (which evaluates to 9).
931 isc_mem_put(key->mctx, bufs[i],
932 priv.elements[i].length);
933 }
934 }
935 #if OPENSSL_VERSION_NUMBER < 0x30000000L
936 RSA_free(rsa);
/lib/dns/opensslrsa_link.c: 930 in opensslrsa_tofile()
924
925 priv.nelements = i;
926 ret = dst__privstruct_writefile(key, &priv, directory);
927
928 err:
929 while (i--) {
CID 340807: (OVERRUN)
Overrunning array "bufs" of 8 8-byte elements at element index 9 (byte offset 79) using index "i" (which evaluates to 9).
930 if (bufs[i] != NULL) {
931 isc_mem_put(key->mctx, bufs[i],
932 priv.elements[i].length);
933 }
934 }
935 #if OPENSSL_VERSION_NUMBER < 0x30000000L
/lib/dns/opensslrsa_link.c: 931 in opensslrsa_tofile()
925 priv.nelements = i;
926 ret = dst__privstruct_writefile(key, &priv, directory);
927
928 err:
929 while (i--) {
930 if (bufs[i] != NULL) {
CID 340807: (OVERRUN)
Overrunning array "bufs" of 8 8-byte elements at element index 9 (byte offset 79) using index "i" (which evaluates to 9).
931 isc_mem_put(key->mctx, bufs[i],
932 priv.elements[i].length);
933 }
934 }
935 #if OPENSSL_VERSION_NUMBER < 0x30000000L
936 RSA_free(rsa);
Edited by Mark Andrews