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.
diff --git a/src/ssl_sock.c b/src/ssl_sock.c
index 58776ee..8f84c67 100644
--- a/src/ssl_sock.c
+++ b/src/ssl_sock.c
@@ -3762,12 +3762,16 @@
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;
}