diff options
author | Doug Hogan <doug@cvs.openbsd.org> | 2015-10-03 06:47:33 +0000 |
---|---|---|
committer | Doug Hogan <doug@cvs.openbsd.org> | 2015-10-03 06:47:33 +0000 |
commit | f7e3bbcbe22b64772ec5d1d2d4109a0b77687fbf (patch) | |
tree | 3ed11e9d6d515acfd9ffacbf4cee62c898bbe0c9 /lib/libssl | |
parent | 371abceae3dba18c359d90d317589e0379b90051 (diff) |
SSL_new(): fix ref counting and memory leak in error path.
Rather than a half-hearted attempt to free up resources and fix
ref counting at the SSL_CTX level, let SSL_free() do its job.
This diff got lost in the shuffle somewhere. It's from last year.
Ref counting error reported by Parakleta in github ticket #51. Thanks!
ok jsing@, beck@
Diffstat (limited to 'lib/libssl')
-rw-r--r-- | lib/libssl/src/ssl/ssl_lib.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/libssl/src/ssl/ssl_lib.c b/lib/libssl/src/ssl/ssl_lib.c index b772f5f8105..0b094e8db6b 100644 --- a/lib/libssl/src/ssl/ssl_lib.c +++ b/lib/libssl/src/ssl/ssl_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_lib.c,v 1.112 2015/09/12 19:45:16 jsing Exp $ */ +/* $OpenBSD: ssl_lib.c,v 1.113 2015/10/03 06:47:32 doug Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -359,15 +359,10 @@ SSL_new(SSL_CTX *ctx) CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL, s, &s->ex_data); - return (s); + err: - if (s != NULL) { - if (s->cert != NULL) - ssl_cert_free(s->cert); - SSL_CTX_free(s->ctx); /* decrement reference count */ - free(s); - } + SSL_free(s); SSLerr(SSL_F_SSL_NEW, ERR_R_MALLOC_FAILURE); return (NULL); } |