diff options
author | David Benjamin <davidben@chromium.org> | 2014-12-12 23:50:29 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2014-12-14 02:22:21 +0300 |
commit | 63c55a8e3527b60f7694e656c8aa1fa081100193 (patch) | |
tree | 1902ad29ab749611300144f6fb3d7deb16d44822 /ssl/d1_srvr.c | |
parent | 1f48fba861901389b9e7ab1b3f569af30f25c4d5 (diff) |
Fix memory leak on failure.
Match the server logic to the client state machine and free if BUF_MEM_grow
fails.
Change-Id: I1a249f7b8c222cd710e969e17a1cba1f469f73e3
Diffstat (limited to 'ssl/d1_srvr.c')
-rw-r--r-- | ssl/d1_srvr.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ssl/d1_srvr.c b/ssl/d1_srvr.c index fad89582..90cdb9e5 100644 --- a/ssl/d1_srvr.c +++ b/ssl/d1_srvr.c @@ -130,7 +130,7 @@ static int dtls1_send_hello_verify_request(SSL *s); int dtls1_accept(SSL *s) { - BUF_MEM *buf; + BUF_MEM *buf = NULL; void (*cb)(const SSL *ssl,int type,int val)=NULL; unsigned long alg_a; int ret= -1; @@ -184,6 +184,7 @@ int dtls1_accept(SSL *s) goto end; } s->init_buf=buf; + buf = NULL; } if (!ssl3_setup_buffers(s)) @@ -588,7 +589,8 @@ end: /* BIO_flush(s->wbio); */ s->in_handshake--; - + if (buf != NULL) + BUF_MEM_free(buf); if (cb != NULL) cb(s,SSL_CB_ACCEPT_EXIT,ret); return(ret); |