Fix memory leak with client auth.

(Imported from upstream's bc5ec653ba65fedb1619c8182088497de8a97a70)
This commit is contained in:
Adam Langley 2014-06-20 12:00:00 -07:00
parent 64c2223310
commit db4f9521b5

View File

@ -3987,6 +3987,11 @@ static int tls1_set_shared_sigalgs(SSL *s)
TLS_SIGALGS *salgs = NULL; TLS_SIGALGS *salgs = NULL;
CERT *c = s->cert; CERT *c = s->cert;
unsigned int is_suiteb = tls1_suiteb(s); unsigned int is_suiteb = tls1_suiteb(s);
if (c->shared_sigalgs)
{
OPENSSL_free(c->shared_sigalgs);
c->shared_sigalgs = NULL;
}
/* If client use client signature algorithms if not NULL */ /* If client use client signature algorithms if not NULL */
if (!s->server && c->client_sigalgs && !is_suiteb) if (!s->server && c->client_sigalgs && !is_suiteb)
{ {
@ -4043,6 +4048,8 @@ int tls1_process_sigalgs(SSL *s, const unsigned char *data, int dsize)
if (!c) if (!c)
return 0; return 0;
if (c->peer_sigalgs)
OPENSSL_free(c->peer_sigalgs);
c->peer_sigalgs = OPENSSL_malloc(dsize); c->peer_sigalgs = OPENSSL_malloc(dsize);
if (!c->peer_sigalgs) if (!c->peer_sigalgs)
return 0; return 0;