[Openvpn-devel] Fix memory leak in SSL_CTX_use_certificate

Message ID 20180926192706.29460-1-steffan@karger.me
State Accepted
Headers show
Series
  • [Openvpn-devel] Fix memory leak in SSL_CTX_use_certificate
Related show

Commit Message

Steffan Karger Sept. 26, 2018, 7:27 p.m.
Commit 98bfeeb4 introduced a memory leak in SSL_CTX_use_certificate by
removing the "if(x509) { ... }" bit while not changing the
"else if(x) {}" right after to an "if(x) {}".

Signed-off-by: Steffan Karger <steffan@karger.me>
---
 src/openvpn/ssl_openssl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Arne Schwabe Sept. 27, 2018, 4:39 p.m. | #1
Am 26.09.18 um 21:27 schrieb Steffan Karger:
> Commit 98bfeeb4 introduced a memory leak in SSL_CTX_use_certificate by
> removing the "if(x509) { ... }" bit while not changing the
> "else if(x) {}" right after to an "if(x) {}".

Hmpf, I should have spotted that.

Acked-By: Arne Schwabe <arne@rfc2549.org>

Arne
Gert Doering Sept. 27, 2018, 5:51 p.m. | #2
Your patch has been applied to the master branch.

commit 5544f47b0eb31e516aa8afbb68579e35e69cf7e7
Author: Steffan Karger
Date:   Wed Sep 26 21:27:06 2018 +0200

     Fix memory leak in SSL_CTX_use_certificate

     Signed-off-by: Steffan Karger <steffan@karger.me>
     Acked-by: Arne Schwabe <arne@rfc2549.org>
     Message-Id: <20180926192706.29460-1-steffan@karger.me>
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_openssl.c
index d9bc9d74..fe4db604 100644
--- a/src/openvpn/ssl_openssl.c
+++ b/src/openvpn/ssl_openssl.c
@@ -855,7 +855,7 @@  end:
     {
         BIO_free(in);
     }
-    else if (x)
+    if (x)
     {
         X509_free(x);
     }