aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Tim Segers <tsegers@pm.me>2023-02-08 23:26:35 +0100
committerGravatar Tim Segers <tsegers@pm.me>2023-02-08 23:28:24 +0100
commit163b67306b5903ab83ad1de9f9eed2c582177d35 (patch)
treeff1f42384b6db08efd2aa1549520aaf08d915f65 /src
parent5d252b1f1710c4a2ef0316e9058f0e2f94d44490 (diff)
downloadopendeco-163b67306b5903ab83ad1de9f9eed2c582177d35.tar.gz
Remove NULL checks before calling free()
Diffstat (limited to 'src')
-rw-r--r--src/opendeco-cli.c8
-rw-r--r--src/opendeco-conf.c8
2 files changed, 4 insertions, 12 deletions
diff --git a/src/opendeco-cli.c b/src/opendeco-cli.c
index 579e013..e3fd852 100644
--- a/src/opendeco-cli.c
+++ b/src/opendeco-cli.c
@@ -79,9 +79,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
arguments->time = arg ? atof(arg) : -1;
break;
case 'g':
- if (arguments->gas)
- free(arguments->gas);
-
+ free(arguments->gas);
arguments->gas = strdup(arg);
break;
case 'p':
@@ -100,9 +98,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
arguments->gfhigh = arg ? atoi(arg) : -1;
break;
case 'G':
- if (arguments->decogasses)
- free(arguments->decogasses);
-
+ free(arguments->decogasses);
arguments->decogasses = strdup(arg);
break;
case 'S':
diff --git a/src/opendeco-conf.c b/src/opendeco-conf.c
index d385bb0..e19440b 100644
--- a/src/opendeco-conf.c
+++ b/src/opendeco-conf.c
@@ -35,9 +35,7 @@ int opendeco_conf_parse(const char *confpath, struct arguments *arguments)
toml_datum_t g = toml_string_in(dive, "gas");
if (g.ok) {
- if (arguments->gas)
- free(arguments->gas);
-
+ free(arguments->gas);
arguments->gas = g.u.s;
}
@@ -73,9 +71,7 @@ int opendeco_conf_parse(const char *confpath, struct arguments *arguments)
toml_datum_t G = toml_string_in(deco, "decogasses");
if (G.ok) {
- if (arguments->decogasses)
- free(arguments->decogasses);
-
+ free(arguments->decogasses);
arguments->decogasses = G.u.s;
}