From 784934498fac88eaeff106e22bcab44c272e2cc9 Mon Sep 17 00:00:00 2001 From: Pascal Cuoq Date: Mon, 23 Nov 2015 00:13:15 +0100 Subject: [PATCH] ssl3_free(): Return if it wasn't created If somewhere in SSL_new() there is a memory allocation failure, ssl3_free() can get called with s->s3 still being NULL. Patch also provided by Willy Tarreau Signed-off-by: Kurt Roeckx Reviewed-by: Viktor Dukhovni (cherry picked from commit 3e7bd2ce0b16f8611298175d6dc7cb35ee06ea6d) --- ssl/s3_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c index de917d3f83..f716d77c81 100644 --- a/ssl/s3_lib.c +++ b/ssl/s3_lib.c @@ -2955,7 +2955,7 @@ int ssl3_new(SSL *s) void ssl3_free(SSL *s) { - if (s == NULL) + if (s == NULL || s->s3 == NULL) return; #ifdef TLSEXT_TYPE_opaque_prf_input -- 2.34.1