Merge remote-tracking branch 'public/pr/2058' into mbedtls-2.1-proposed

This commit is contained in:
Simon Butcher 2018-10-28 17:25:16 +00:00
commit a1f11cfc38
2 changed files with 7 additions and 1 deletions

View file

@ -16,6 +16,8 @@ Bugfix
application leading to a memory leak in case both
MBEDTLS_MEMORY_BUFFER_ALLOC_C and MBEDTLS_MEMORY_BACKTRACE are set.
Fixes #2069.
* Fix memory leak and freeing without initialization in the example
program programs/x509/cert_write. Fixes #1422.
Changes
* "make apidoc" now generates the documentation for the current

View file

@ -238,6 +238,7 @@ int main( int argc, char *argv[] )
mbedtls_pk_init( &loaded_subject_key );
mbedtls_mpi_init( &serial );
mbedtls_ctr_drbg_init( &ctr_drbg );
mbedtls_entropy_init( &entropy );
#if defined(MBEDTLS_X509_CSR_PARSE_C)
mbedtls_x509_csr_init( &csr );
#endif
@ -472,7 +473,6 @@ int main( int argc, char *argv[] )
mbedtls_printf( " . Seeding the random number generator..." );
fflush( stdout );
mbedtls_entropy_init( &entropy );
if( ( ret = mbedtls_ctr_drbg_seed( &ctr_drbg, mbedtls_entropy_func, &entropy,
(const unsigned char *) pers,
strlen( pers ) ) ) != 0 )
@ -789,6 +789,10 @@ int main( int argc, char *argv[] )
mbedtls_printf( " ok\n" );
exit:
#if defined(MBEDTLS_X509_CSR_PARSE_C)
mbedtls_x509_csr_free( &csr );
#endif /* MBEDTLS_X509_CSR_PARSE_C */
mbedtls_x509_crt_free( &issuer_crt );
mbedtls_x509write_crt_free( &crt );
mbedtls_pk_free( &loaded_subject_key );
mbedtls_pk_free( &loaded_issuer_key );