Ian Jauslin
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Jauslin <ian.jauslin@rutgers.edu>2023-04-14 15:11:55 -0400
committerIan Jauslin <ian.jauslin@rutgers.edu>2023-04-14 15:12:07 -0400
commit3f6e6ef423f13752de7a001dbc8a1748f1f6cafe (patch)
treeaa6065a63982a805bf5e11158fcbf6e0306d7d5c /src
parentd5d5c15b7e582106b7394e492267bf4f16d4f47a (diff)
Fix memory issue
Diffstat (limited to 'src')
-rw-r--r--src/main.c2
-rw-r--r--src/navier-stokes.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 6ccb9f4..d7aa8fd 100644
--- a/src/main.c
+++ b/src/main.c
@@ -578,7 +578,7 @@ int set_parameter(
// matches any argument that starts with 'file:'
else if (strncmp(rhs,"file:",5)==0){
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);
}
else{
diff --git a/src/navier-stokes.c b/src/navier-stokes.c
index c751276..40fb9aa 100644
--- a/src/navier-stokes.c
+++ b/src/navier-stokes.c
@@ -251,7 +251,7 @@ int eea(
// 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);
remove_entry(params, "starting_time");
remove_entry(params, "init");