diff --git a/src/quicksort.c b/src/quicksort.c index 03c0899..8bb2883 100644 --- a/src/quicksort.c +++ b/src/quicksort.c @@ -99,21 +99,22 @@ int benchmark(int argc, char **argv) { break; case 'n': n = atoi(optarg); - if (n <= 0) { - goto usage; - } break; case 't': nthreads = atoi(optarg); - if (nthreads <= 0) { - goto usage; - } break; default: goto usage; } } + if (n <= 0) { + goto usage; + } + if (nthreads < 0 && !serial) { + goto usage; + } + a = malloc(n * sizeof(int)); unsigned long long s = 0;