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/s3_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/s3_srvr.c')
-rw-r--r-- | ssl/s3_srvr.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ssl/s3_srvr.c b/ssl/s3_srvr.c index 5f3f8398..1d3285d2 100644 --- a/ssl/s3_srvr.c +++ b/ssl/s3_srvr.c @@ -174,7 +174,7 @@ int ssl3_accept(SSL *s) { - BUF_MEM *buf; + BUF_MEM *buf = NULL; unsigned long alg_a; void (*cb)(const SSL *ssl,int type,int val)=NULL; int ret= -1; @@ -228,6 +228,7 @@ int ssl3_accept(SSL *s) goto end; } s->init_buf=buf; + buf = NULL; } if (!ssl3_setup_buffers(s)) @@ -666,6 +667,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); |