Fix memory leak.

Always perform nexproto callback argument initialisation in s_server
otherwise we use uninitialised data if -nocert is specified.
This commit is contained in:
Dr. Stephen Henson 2012-07-03 16:36:10 +00:00
parent 4dc40f5eec
commit 25da47c3c8
2 changed files with 19 additions and 16 deletions

View File

@ -1890,6 +1890,10 @@ end:
print_stuff(bio_c_out,con,1); print_stuff(bio_c_out,con,1);
SSL_free(con); 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 (ctx != NULL) SSL_CTX_free(ctx);
if (cert) if (cert)
X509_free(cert); X509_free(cert);

View File

@ -1431,13 +1431,14 @@ bad:
goto end; goto end;
} }
} }
#endif
}
# ifndef OPENSSL_NO_NEXTPROTONEG #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG)
if (next_proto_neg_in) if (next_proto_neg_in)
{ {
unsigned short len; unsigned short len;
next_proto.data = next_protos_parse(&len, next_proto.data = next_protos_parse(&len, next_proto_neg_in);
next_proto_neg_in);
if (next_proto.data == NULL) if (next_proto.data == NULL)
goto end; goto end;
next_proto.len = len; next_proto.len = len;
@ -1446,9 +1447,7 @@ bad:
{ {
next_proto.data = NULL; next_proto.data = NULL;
} }
# endif
#endif #endif
}
if (s_dcert_file) if (s_dcert_file)