Skip to content

Commit

Permalink
cleanup previous ssl chain/privkey
Browse files Browse the repository at this point in the history
  • Loading branch information
smittals2 committed Feb 20, 2025
1 parent 88013e2 commit dda1fc5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ssl/ssl_cert.cc
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,14 @@ static int cert_set_chain_and_key(
CERT_PKEY *cert_pkey = &cert->cert_private_keys[idx];

// Update certificate slot index once all checks have passed.
if (cert_pkey->privatekey) {
cert_pkey->privatekey.reset();
}
cert_pkey->privatekey = UpRef(privkey);
cert->key_method = privkey_method;
if (cert_pkey->chain) {
cert_pkey->chain.reset();
}
cert_pkey->chain = std::move(certs_sk);
cert->cert_private_key_idx = idx;
return 1;
Expand Down

0 comments on commit dda1fc5

Please sign in to comment.