Bugfix memory issue in global options.

master
Julian M. Kunkel 2020-11-06 11:40:31 +00:00
parent a59e98d7a6
commit 306598db67
2 changed files with 4 additions and 2 deletions

View File

@ -128,6 +128,8 @@ void aiori_supported_apis(char * APIs, char * APIs_legacy, enum bench_type type)
{ {
ior_aiori_t **tmp = available_aiori; ior_aiori_t **tmp = available_aiori;
char delimiter = ' '; char delimiter = ' ';
*APIs = 0;
*APIs_legacy = 0;
while (*tmp != NULL) while (*tmp != NULL)
{ {
@ -136,7 +138,6 @@ void aiori_supported_apis(char * APIs, char * APIs_legacy, enum bench_type type)
tmp++; tmp++;
continue; continue;
} }
if (delimiter == ' ') if (delimiter == ' ')
{ {
APIs += sprintf(APIs, "%s", (*tmp)->name); 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) if ((*tmp)->name_legacy != NULL)
APIs_legacy += sprintf(APIs_legacy, "%c%s", APIs_legacy += sprintf(APIs_legacy, "%c%s",
delimiter, (*tmp)->name_legacy); delimiter, (*tmp)->name_legacy);
tmp++; tmp++;
} }
} }

View File

@ -384,7 +384,7 @@ option_help * createGlobalOptions(IOR_param_t * params){
char APIs[1024]; char APIs[1024];
char APIs_legacy[1024]; char APIs_legacy[1024];
aiori_supported_apis(APIs, APIs_legacy, IOR); aiori_supported_apis(APIs, APIs_legacy, IOR);
char apiStr[1024]; char * apiStr = safeMalloc(1024);
sprintf(apiStr, "API for I/O [%s]", APIs); sprintf(apiStr, "API for I/O [%s]", APIs);
option_help o [] = { option_help o [] = {