aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/opendeco-cli.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/opendeco-cli.c')
-rw-r--r--src/opendeco-cli.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/opendeco-cli.c b/src/opendeco-cli.c
index 4e21405..e200fcd 100644
--- a/src/opendeco-cli.c
+++ b/src/opendeco-cli.c
@@ -2,6 +2,7 @@
#include <argp.h>
#include <stdlib.h>
+#include <string.h>
#include "opendeco-cli.h"
@@ -47,7 +48,10 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
arguments->time = arg ? atof(arg) : -1;
break;
case 'g':
- arguments->gas = arg;
+ if (arguments->gas)
+ free(arguments->gas);
+
+ arguments->gas = strdup(arg);
break;
case 'p':
arguments->SURFACE_PRESSURE = arg ? atof(arg) : -1;
@@ -62,7 +66,10 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
arguments->gfhigh = arg ? atoi(arg) : 100;
break;
case 'G':
- arguments->decogasses = arg;
+ if (arguments->decogasses)
+ free(arguments->decogasses);
+
+ arguments->decogasses = strdup(arg);
break;
case 'S':
arguments->SWITCH_INTERMEDIATE = 0;