summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorchenzizhan <[email protected]>2024-04-07 11:45:15 +0800
committerchenzizhan <[email protected]>2024-04-07 11:45:15 +0800
commit934cd428a063367c76a1fbff73ce1a2391f4be96 (patch)
tree64f6e71dfba388e901800ecc6fd6ebf78e6007b7 /src
parent3269ef27d012b244093fa623697a9db7ff59157d (diff)
modify:check max_thread_num before new fsev4.5.5
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;