From 7498e9dae69f2004b73387ab2778c4e8c1f3d27d Mon Sep 17 00:00:00 2001 From: Uday Kakade Date: Mon, 20 Apr 2026 14:03:03 +0530 Subject: [PATCH] bench: refactor to use dynamic memory allocation in stats/strided/smean --- .../stats/strided/smean/benchmark/c/benchmark.length.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/node_modules/@stdlib/stats/strided/smean/benchmark/c/benchmark.length.c b/lib/node_modules/@stdlib/stats/strided/smean/benchmark/c/benchmark.length.c index b308bfa27d05..d7bee5842f8c 100644 --- a/lib/node_modules/@stdlib/stats/strided/smean/benchmark/c/benchmark.length.c +++ b/lib/node_modules/@stdlib/stats/strided/smean/benchmark/c/benchmark.length.c @@ -96,11 +96,12 @@ static float rand_float( void ) { */ static double benchmark( int iterations, int len ) { double elapsed; - float x[ len ]; + float *x; float v; double t; int i; + x = (float *) malloc( len * sizeof( float ) ); for ( i = 0; i < len; i++ ) { x[ i ] = ( rand_float()*20000.0f ) - 10000.0f; } @@ -118,6 +119,7 @@ static double benchmark( int iterations, int len ) { if ( v != v ) { printf( "should not return NaN\n" ); } + free( x ); return elapsed; }