Fix error handling in SSL_CTX_new
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Thu, 22 Dec 2016 09:12:03 +0000 (10:12 +0100)
committerKurt Roeckx <kurt@roeckx.be>
Tue, 10 Jan 2017 21:34:17 +0000 (22:34 +0100)
Dont free rbuf_freelist here, SSL_CTX_free will do that.

Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Rich Salz <rsalz@openssl.org>
GH: #2129

ssl/ssl_lib.c

index 42b980ac26a05f658fe952da1299981bb4380a55..f8054dae6b6b1047e933d8b9fc72b94915f08be5 100644 (file)
@@ -2030,10 +2030,8 @@ SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth)
     ret->rbuf_freelist->len = 0;
     ret->rbuf_freelist->head = NULL;
     ret->wbuf_freelist = OPENSSL_malloc(sizeof(SSL3_BUF_FREELIST));
-    if (!ret->wbuf_freelist) {
-        OPENSSL_free(ret->rbuf_freelist);
+    if (!ret->wbuf_freelist)
         goto err;
-    }
     ret->wbuf_freelist->chunklen = 0;
     ret->wbuf_freelist->len = 0;
     ret->wbuf_freelist->head = NULL;