Skip to content

Commit

Permalink
Fix memory leak when parsing X509 certs (#2010)
Browse files Browse the repository at this point in the history
  • Loading branch information
alberk8 authored Aug 13, 2021
1 parent 5382143 commit 261206d
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ bool ssl_parse_certificate_internal(void *certificate, size_t size, void *pwd, v
ret = mbedtls_x509_crt_parse(&cacert, (const unsigned char *)certificate, size);
if (ret < 0)
{
mbedtls_x509_crt_free(&cacert);
return false;
}

Expand All @@ -48,5 +49,7 @@ bool ssl_parse_certificate_internal(void *certificate, size_t size, void *pwd, v

SSL_GetCertDateTime_internal(&x509->ExpirationDate, &cacert.valid_to);

mbedtls_x509_crt_free(&cacert);

return true;
}

0 comments on commit 261206d

Please sign in to comment.