Fix memory issue

This commit is contained in:
Ian Jauslin 2023-04-14 15:11:55 -04:00
parent d5d5c15b7e
commit 3f6e6ef423
2 changed files with 2 additions and 2 deletions

View File

@ -578,7 +578,7 @@ int set_parameter(
// matches any argument that starts with 'file:' // matches any argument that starts with 'file:'
else if (strncmp(rhs,"file:",5)==0){ else if (strncmp(rhs,"file:",5)==0){
parameters->init=INIT_FILE; parameters->init=INIT_FILE;
*initfile_str=calloc(sizeof(char), strlen(rhs)-5); *initfile_str=calloc(sizeof(char), strlen(rhs)-5+1);
strcpy(*initfile_str, rhs+5); strcpy(*initfile_str, rhs+5);
} }
else{ else{

View File

@ -251,7 +251,7 @@ int eea(
// params // params
// allocate buffer for params // allocate buffer for params
char* params=calloc(sizeof(char), strlen(params_string)); char* params=calloc(sizeof(char), strlen(params_string)+1);
strcpy(params, params_string); strcpy(params, params_string);
remove_entry(params, "starting_time"); remove_entry(params, "starting_time");
remove_entry(params, "init"); remove_entry(params, "init");