Skip to content

Commit e04b130

Browse files
authored
Merge pull request #882 from rhenium/ky/ssl-fix-leak-extra_chain_cert
ssl: fix potential memory leak in SSLContext#setup
2 parents 1b34bb2 + 80bcf72 commit e04b130

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ext/openssl/ossl_ssl.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,9 @@ ossl_sslctx_add_extra_chain_cert_i(RB_BLOCK_CALL_FUNC_ARGLIST(i, arg))
430430

431431
GetSSLCTX(arg, ctx);
432432
x509 = DupX509CertPtr(i);
433-
if(!SSL_CTX_add_extra_chain_cert(ctx, x509)){
434-
ossl_raise(eSSLError, NULL);
433+
if (!SSL_CTX_add_extra_chain_cert(ctx, x509)) {
434+
X509_free(x509);
435+
ossl_raise(eSSLError, "SSL_CTX_add_extra_chain_cert");
435436
}
436437

437438
return i;

0 commit comments

Comments
 (0)