Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport 2.7: Renaming "new" variable #1819

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ mbed TLS ChangeLog (Sorted per branch, date)
= mbed TLS x.x.x branch released xxxx-xx-xx

Bugfix
* Fix compilation error on C++, because of a variable named new.
Found and fixed by Hirotaka Niisato in #1783.
* Change the shebang line in Perl scripts to look up perl in the PATH.
Contributed by fbrosson in #1533.
* Fix a memory leak in mbedtls_x509_csr_parse(), found by catenacyber,
Expand Down
16 changes: 8 additions & 8 deletions library/ssl_tls.c
Original file line number Diff line number Diff line change
Expand Up @@ -6017,27 +6017,27 @@ static int ssl_append_key_cert( mbedtls_ssl_key_cert **head,
mbedtls_x509_crt *cert,
mbedtls_pk_context *key )
{
mbedtls_ssl_key_cert *new;
mbedtls_ssl_key_cert *new_cert;

new = mbedtls_calloc( 1, sizeof( mbedtls_ssl_key_cert ) );
if( new == NULL )
new_cert = mbedtls_calloc( 1, sizeof( mbedtls_ssl_key_cert ) );
if( new_cert == NULL )
return( MBEDTLS_ERR_SSL_ALLOC_FAILED );

new->cert = cert;
new->key = key;
new->next = NULL;
new_cert->cert = cert;
new_cert->key = key;
new_cert->next = NULL;

/* Update head is the list was null, else add to the end */
if( *head == NULL )
{
*head = new;
*head = new_cert;
}
else
{
mbedtls_ssl_key_cert *cur = *head;
while( cur->next != NULL )
cur = cur->next;
cur->next = new;
cur->next = new_cert;
}

return( 0 );
Expand Down