Skip to content

Commit 022edac

Browse files
chore: fix C lint errors (issue #6887)
Signed-off-by: Lalit Narayan Yadav <[email protected]>
1 parent 58747ab commit 022edac

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/node_modules/@stdlib/stats/base/dmeanvarpn/benchmark/c/benchmark.length.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,16 @@ static double rand_double( void ) {
9797
static double benchmark( int iterations, int len ) {
9898
double elapsed;
9999
double out[ 2 ];
100-
double x[ len ];
100+
double *x;
101101
double t;
102102
int i;
103103

104+
x = malloc(len * sizeof(double));
105+
if (x == NULL) {
106+
fprintf(stderr, "Memory allocation failed\n");
107+
exit(1);
108+
}
109+
104110
for ( i = 0; i < len; i++ ) {
105111
x[ i ] = ( rand_double() * 20000.0 ) - 10000.0;
106112
}

0 commit comments

Comments
 (0)