Skip to content

Commit

Permalink
Fix usage of ASSERT_ALLOC()
Browse files Browse the repository at this point in the history
The second argument is the number of elements of the type the first
argument is pointing to, so we shouldn't be using sizeof there.

This was resulting in overly large allocations.

Signed-off-by: Manuel Pégourié-Gonnard <[email protected]>
  • Loading branch information
mpg committed Oct 14, 2022
1 parent 279188f commit d44d3ea
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/suites/test_suite_asn1parse.function
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ void free_named_data_list( int length )
for( i = 0; i < length; i++ )
{
mbedtls_asn1_named_data *new = NULL;
ASSERT_ALLOC( new, sizeof( mbedtls_asn1_named_data ) );
ASSERT_ALLOC( new, 1 );
new->next = head;
head = new;
}
Expand Down

0 comments on commit d44d3ea

Please sign in to comment.