From 306598db67a6faa76d8195a178b7d57292bc62fa Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Fri, 6 Nov 2020 11:40:31 +0000 Subject: [PATCH] Bugfix memory issue in global options. --- src/aiori.c | 4 +++- src/parse_options.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/aiori.c b/src/aiori.c index 897abb6..6c9a971 100644 --- a/src/aiori.c +++ b/src/aiori.c @@ -128,6 +128,8 @@ void aiori_supported_apis(char * APIs, char * APIs_legacy, enum bench_type type) { ior_aiori_t **tmp = available_aiori; char delimiter = ' '; + *APIs = 0; + *APIs_legacy = 0; while (*tmp != NULL) { @@ -136,7 +138,6 @@ void aiori_supported_apis(char * APIs, char * APIs_legacy, enum bench_type type) tmp++; continue; } - if (delimiter == ' ') { APIs += sprintf(APIs, "%s", (*tmp)->name); @@ -148,6 +149,7 @@ void aiori_supported_apis(char * APIs, char * APIs_legacy, enum bench_type type) if ((*tmp)->name_legacy != NULL) APIs_legacy += sprintf(APIs_legacy, "%c%s", delimiter, (*tmp)->name_legacy); + tmp++; } } diff --git a/src/parse_options.c b/src/parse_options.c index 87e3c91..12f8e0c 100755 --- a/src/parse_options.c +++ b/src/parse_options.c @@ -384,7 +384,7 @@ option_help * createGlobalOptions(IOR_param_t * params){ char APIs[1024]; char APIs_legacy[1024]; aiori_supported_apis(APIs, APIs_legacy, IOR); - char apiStr[1024]; + char * apiStr = safeMalloc(1024); sprintf(apiStr, "API for I/O [%s]", APIs); option_help o [] = {