summaryrefslogtreecommitdiff
path: root/lib/libssl
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2014-06-30 14:13:28 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2014-06-30 14:13:28 +0000
commitab6cfbd8bd550bc937188a8b31032498a7591abd (patch)
treed3a89e6bc9425094d1e65697aff631db6104cc80 /lib/libssl
parentd6897b9f9e6a650151f8446bacc5a5316313c5ae (diff)
fix the identical leak in three different files.
reported by Brent Cook, original diff by logan
Diffstat (limited to 'lib/libssl')
-rw-r--r--lib/libssl/src/ssl/d1_srvr.c5
-rw-r--r--lib/libssl/src/ssl/s23_srvr.c5
-rw-r--r--lib/libssl/src/ssl/s3_srvr.c5
3 files changed, 9 insertions, 6 deletions
diff --git a/lib/libssl/src/ssl/d1_srvr.c b/lib/libssl/src/ssl/d1_srvr.c
index 1c4b2e9f6da..d4d564a6883 100644
--- a/lib/libssl/src/ssl/d1_srvr.c
+++ b/lib/libssl/src/ssl/d1_srvr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: d1_srvr.c,v 1.26 2014/06/12 15:49:31 deraadt Exp $ */
+/* $OpenBSD: d1_srvr.c,v 1.27 2014/06/30 14:13:27 tedu Exp $ */
/*
* DTLS implementation written by Nagendra Modadugu
* (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -176,7 +176,6 @@ dtls1_get_server_method(int ver)
int
dtls1_accept(SSL *s)
{
- BUF_MEM *buf;
void (*cb)(const SSL *ssl, int type, int val) = NULL;
unsigned long alg_k;
int ret = -1;
@@ -241,11 +240,13 @@ dtls1_accept(SSL *s)
s->type = SSL_ST_ACCEPT;
if (s->init_buf == NULL) {
+ BUF_MEM *buf;
if ((buf = BUF_MEM_new()) == NULL) {
ret = -1;
goto end;
}
if (!BUF_MEM_grow(buf, SSL3_RT_MAX_PLAIN_LENGTH)) {
+ BUF_MEM_free(buf);
ret = -1;
goto end;
}
diff --git a/lib/libssl/src/ssl/s23_srvr.c b/lib/libssl/src/ssl/s23_srvr.c
index 52dc261814c..cd1a5174a70 100644
--- a/lib/libssl/src/ssl/s23_srvr.c
+++ b/lib/libssl/src/ssl/s23_srvr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: s23_srvr.c,v 1.28 2014/06/12 15:49:31 deraadt Exp $ */
+/* $OpenBSD: s23_srvr.c,v 1.29 2014/06/30 14:13:27 tedu Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -174,7 +174,6 @@ ssl23_get_server_method(int ver)
int
ssl23_accept(SSL *s)
{
- BUF_MEM *buf;
void (*cb)(const SSL *ssl, int type, int val) = NULL;
int ret = -1;
int new_state, state;
@@ -208,11 +207,13 @@ ssl23_accept(SSL *s)
s->type = SSL_ST_ACCEPT;
if (s->init_buf == NULL) {
+ BUF_MEM *buf;
if ((buf = BUF_MEM_new()) == NULL) {
ret = -1;
goto end;
}
if (!BUF_MEM_grow(buf, SSL3_RT_MAX_PLAIN_LENGTH)) {
+ BUF_MEM_free(buf);
ret = -1;
goto end;
}
diff --git a/lib/libssl/src/ssl/s3_srvr.c b/lib/libssl/src/ssl/s3_srvr.c
index 161534295fa..a3387040a93 100644
--- a/lib/libssl/src/ssl/s3_srvr.c
+++ b/lib/libssl/src/ssl/s3_srvr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: s3_srvr.c,v 1.66 2014/06/19 21:29:51 tedu Exp $ */
+/* $OpenBSD: s3_srvr.c,v 1.67 2014/06/30 14:13:27 tedu Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -214,7 +214,6 @@ ssl3_get_server_method(int ver)
int
ssl3_accept(SSL *s)
{
- BUF_MEM *buf;
unsigned long alg_k;
void (*cb)(const SSL *ssl, int type, int val) = NULL;
int ret = -1;
@@ -264,12 +263,14 @@ ssl3_accept(SSL *s)
s->type = SSL_ST_ACCEPT;
if (s->init_buf == NULL) {
+ BUF_MEM *buf;
if ((buf = BUF_MEM_new()) == NULL) {
ret = -1;
goto end;
}
if (!BUF_MEM_grow(buf,
SSL3_RT_MAX_PLAIN_LENGTH)) {
+ BUF_MEM_free(buf);
ret = -1;
goto end;
}