summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fieldstat_easy.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/fieldstat_easy.c b/src/fieldstat_easy.c
index 879a06f..1b56688 100644
--- a/src/fieldstat_easy.c
+++ b/src/fieldstat_easy.c
@@ -115,6 +115,9 @@ void *fs_easy_output_thread(void *arg) // return void * for pthread_create check
}
struct fieldstat_easy *fieldstat_easy_new(int max_thread_num, const char *name, const struct fieldstat_tag *tags, size_t n_tag) {
+ if (max_thread_num <= 0) {
+ return NULL;
+ }
struct fieldstat_easy *fse = calloc(1, sizeof(struct fieldstat_easy));
fse->fsu = malloc(sizeof(struct fs_easy_thread) * max_thread_num);
fse->max_thread_num = max_thread_num;