Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function beep() {
}
```

The [rule][eslint-rules] may be configured using the same options as supported by [remark][remark-lint-list-item-spacing].
The [rule][eslint-rules] may be configured using the same options as supported by [remark][remark-lint-list-item-spacing].

</section>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,16 @@ static float rand_float( void ) {
*/
static double benchmark( int iterations, int len ) {
double elapsed;
float x[ len ];
float y[ len ];
float *x = (float *) malloc(len * sizeof(float));
float *y = (float *) malloc(len * sizeof(float));
double t;
int i;

if (x == NULL || y == NULL) {
printf("Memory allocation failed.\n");
exit(1);
}

for ( i = 0; i < len; i++ ) {
x[ i ] = ( rand_float()*200.0f ) - 100.0f;
y[ i ] = 0.0f;
Expand All @@ -117,6 +122,11 @@ static double benchmark( int iterations, int len ) {
if ( y[ 0 ] != y[ 0 ] ) {
printf( "should not return NaN\n" );
}

// 🧹 Always clean up heap allocations
free(x);
free(y);

return elapsed;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// cspell:ignore frechet échet

/**
* @license Apache-2.0
*
Expand Down
Loading