From: Dr. Stephen Henson Date: Tue, 3 Jul 2012 16:37:31 +0000 (+0000) Subject: Fix memory leak. X-Git-Tag: OpenSSL_1_0_2-beta1~604 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f142a71c3da0f4a4bd42e9dd6736176bab2358d9;p=oweals%2Fopenssl.git Fix memory leak. Always perform nexproto callback argument initialisation in s_server otherwise we use uninitialised data if -nocert is specified. --- diff --git a/apps/s_client.c b/apps/s_client.c index 2b2b740778..e64aaf66c6 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -1910,6 +1910,10 @@ end: print_stuff(bio_c_out,con,1); SSL_free(con); } +#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) + if (next_proto.data) + OPENSSL_free(next_proto.data); +#endif if (ctx != NULL) SSL_CTX_free(ctx); if (cert) X509_free(cert); diff --git a/apps/s_server.c b/apps/s_server.c index cfe9a34c37..9692c70b2d 100644 --- a/apps/s_server.c +++ b/apps/s_server.c @@ -1470,25 +1470,24 @@ bad: goto end; } } - -# ifndef OPENSSL_NO_NEXTPROTONEG - if (next_proto_neg_in) - { - unsigned short len; - next_proto.data = next_protos_parse(&len, - next_proto_neg_in); - if (next_proto.data == NULL) - goto end; - next_proto.len = len; - } - else - { - next_proto.data = NULL; - } -# endif #endif /* OPENSSL_NO_TLSEXT */ } +#if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) + if (next_proto_neg_in) + { + unsigned short len; + next_proto.data = next_protos_parse(&len, next_proto_neg_in); + if (next_proto.data == NULL) + goto end; + next_proto.len = len; + } + else + { + next_proto.data = NULL; + } +#endif + if (s_dcert_file) {