BUG/MINOR: ssl: memleak of the struct cert_key_and_chain

Free the struct cert_key_and_chain when calling ckchs_free(),
a memory leak can occur when using 'commit ssl cert'.

Must be backported to 2.1.
This commit is contained in:
William Lallemand 2020-04-08 17:38:27 +02:00 committed by William Lallemand
parent caa161982f
commit 8621ac5570
1 changed files with 5 additions and 1 deletions

View File

@ -3762,12 +3762,16 @@ void ckchs_free(struct ckch_store *ckchs)
if (ckchs->multi) {
int n;
for (n = 0; n < SSL_SOCK_NUM_KEYTYPES; n++)
for (n = 0; n < SSL_SOCK_NUM_KEYTYPES; n++) {
ssl_sock_free_cert_key_and_chain_contents(&ckchs->ckch[n]);
}
free(ckchs->ckch);
ckchs->ckch = NULL;
} else
#endif
{
ssl_sock_free_cert_key_and_chain_contents(ckchs->ckch);
free(ckchs->ckch);
ckchs->ckch = NULL;
}