summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2012-07-03 16:36:10 +0000
committerDr. Stephen Henson <steve@openssl.org>2012-07-03 16:36:10 +0000
commit25da47c3c8862cf82fa1e7f32fed9b6c4693ac6e (patch)
tree2df5632947f04ad34980cedafaefc6b037c10bf6 /apps
parent4dc40f5eec7bbd583e87c391151612128bba12f4 (diff)
Fix memory leak.
Always perform nexproto callback argument initialisation in s_server otherwise we use uninitialised data if -nocert is specified.
Diffstat (limited to 'apps')
-rw-r--r--apps/s_client.c4
-rw-r--r--apps/s_server.c31
2 files changed, 19 insertions, 16 deletions
diff --git a/apps/s_client.c b/apps/s_client.c
index 95d23e8608..374998f3c9 100644
--- a/apps/s_client.c
+++ b/apps/s_client.c
@@ -1890,6 +1890,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 7125afafc3..f15cd20914 100644
--- a/apps/s_server.c
+++ b/apps/s_server.c
@@ -1431,25 +1431,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
}
+#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)
{