t/memlock: Verify 'threads' argument
[fio.git] / t / memlock.c
index 3d3579ad25292f0369b16f8a71306e9db7a8eea2..418dc3c48fd0c1b4cf8596564ee22f3f661fd92a 100644 (file)
@@ -26,6 +26,7 @@ static void *worker(void *data)
                        first = 0;
                }
        }
+       free(buf);
        return NULL;
 }
 
@@ -42,6 +43,10 @@ int main(int argc, char *argv[])
 
        mib = strtoul(argv[1], NULL, 10);
        threads = strtoul(argv[2], NULL, 10);
+       if (threads < 1 || threads > 65536) {
+               printf("%s: invalid 'threads' argument\n", argv[0]);
+               return 1;
+       }
 
        pthreads = calloc(threads, sizeof(pthread_t));
        td.mib = mib;