diff options
author | Kurt Roeckx <kurt@roeckx.be> | 2013-12-02 18:07:14 +0100 |
---|---|---|
committer | Kurt Roeckx <kurt@roeckx.be> | 2014-12-04 23:48:44 +0100 |
commit | 6c42b39c95b26f8a48f19aabb78546d7814de978 (patch) | |
tree | 1e1bf41a9430546a0276357c42c7a407b2557578 | |
parent | 241e2dc9362b8d36847c0df00c24e0199234c7c6 (diff) |
dtls1_new: free s on error path
Reviewed-by: Richard Levitte <levitte@openssl.org>
-rw-r--r-- | ssl/d1_lib.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/ssl/d1_lib.c b/ssl/d1_lib.c index 44c7882f3c..f36d570247 100644 --- a/ssl/d1_lib.c +++ b/ssl/d1_lib.c @@ -123,7 +123,11 @@ int dtls1_new(SSL *s) DTLS1_STATE *d1; if (!ssl3_new(s)) return(0); - if ((d1=OPENSSL_malloc(sizeof *d1)) == NULL) return (0); + if ((d1=OPENSSL_malloc(sizeof *d1)) == NULL) + { + ssl3_free(s); + return (0); + } memset(d1,0, sizeof *d1); /* d1->handshake_epoch=0; */ @@ -145,12 +149,13 @@ int dtls1_new(SSL *s) if( ! d1->unprocessed_rcds.q || ! d1->processed_rcds.q || ! d1->buffered_messages || ! d1->sent_messages || ! d1->buffered_app_data.q) { - if ( d1->unprocessed_rcds.q) pqueue_free(d1->unprocessed_rcds.q); - if ( d1->processed_rcds.q) pqueue_free(d1->processed_rcds.q); - if ( d1->buffered_messages) pqueue_free(d1->buffered_messages); + if ( d1->unprocessed_rcds.q) pqueue_free(d1->unprocessed_rcds.q); + if ( d1->processed_rcds.q) pqueue_free(d1->processed_rcds.q); + if ( d1->buffered_messages) pqueue_free(d1->buffered_messages); if ( d1->sent_messages) pqueue_free(d1->sent_messages); if ( d1->buffered_app_data.q) pqueue_free(d1->buffered_app_data.q); OPENSSL_free(d1); + ssl3_free(s); return (0); } |