Change ASSERT_ALLOC to take a size in elements, not bytes
`ASSERT_ALLOC(p, length)` now allocates `length` elements, i.e.
`length * sizeof(*p)` bytes.
diff --git a/tests/suites/helpers.function b/tests/suites/helpers.function
index 686f0ac..7cc9c09 100644
--- a/tests/suites/helpers.function
+++ b/tests/suites/helpers.function
@@ -242,7 +242,7 @@
* You must set \p pointer to \c NULL before calling this macro and
* put `mbedtls_free( pointer )` in the test's cleanup code.
*
- * If \p size is zero, the resulting \p pointer will be \c NULL.
+ * If \p length is zero, the resulting \p pointer will be \c NULL.
* This is usually what we want in tests since API functions are
* supposed to accept null pointers when a buffer size is zero.
*
@@ -252,20 +252,21 @@
* \param pointer An lvalue where the address of the allocated buffer
* will be stored.
* This expression may be evaluated multiple times.
- * \param size Buffer size to allocate in bytes.
+ * \param length Number of elements to allocate.
* This expression may be evaluated multiple times.
*
*/
-#define ASSERT_ALLOC( pointer, size ) \
- do \
- { \
- TEST_ASSERT( ( pointer ) == NULL ); \
- if( ( size ) != 0 ) \
- { \
- ( pointer ) = mbedtls_calloc( 1, ( size ) ); \
- TEST_ASSERT( ( pointer ) != NULL ); \
- } \
- } \
+#define ASSERT_ALLOC( pointer, length ) \
+ do \
+ { \
+ TEST_ASSERT( ( pointer ) == NULL ); \
+ if( ( length ) != 0 ) \
+ { \
+ ( pointer ) = mbedtls_calloc( sizeof( *( pointer ) ), \
+ ( length ) ); \
+ TEST_ASSERT( ( pointer ) != NULL ); \
+ } \
+ } \
while( 0 )
/*