DTLS: fix memory leak when allocation fails.
Change-Id: Ib789362bc0a8aa5460cfce61fef141cb22747b33
This commit is contained in:
parent
d7e23c17a9
commit
389110ae89
@ -126,7 +126,11 @@ int dtls1_new(SSL *s)
|
|||||||
DTLS1_STATE *d1;
|
DTLS1_STATE *d1;
|
||||||
|
|
||||||
if (!ssl3_new(s)) return(0);
|
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);
|
memset(d1,0, sizeof *d1);
|
||||||
|
|
||||||
/* d1->handshake_epoch=0; */
|
/* d1->handshake_epoch=0; */
|
||||||
@ -151,6 +155,7 @@ int dtls1_new(SSL *s)
|
|||||||
if ( d1->sent_messages) pqueue_free(d1->sent_messages);
|
if ( d1->sent_messages) pqueue_free(d1->sent_messages);
|
||||||
if ( d1->buffered_app_data.q) pqueue_free(d1->buffered_app_data.q);
|
if ( d1->buffered_app_data.q) pqueue_free(d1->buffered_app_data.q);
|
||||||
OPENSSL_free(d1);
|
OPENSSL_free(d1);
|
||||||
|
ssl3_free(s);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user