diff options
author | Tim Segers <tsegers@pm.me> | 2023-02-08 23:26:35 +0100 |
---|---|---|
committer | Tim Segers <tsegers@pm.me> | 2023-02-08 23:28:24 +0100 |
commit | 163b67306b5903ab83ad1de9f9eed2c582177d35 (patch) | |
tree | ff1f42384b6db08efd2aa1549520aaf08d915f65 /src | |
parent | 5d252b1f1710c4a2ef0316e9058f0e2f94d44490 (diff) | |
download | opendeco-163b67306b5903ab83ad1de9f9eed2c582177d35.tar.gz |
Remove NULL checks before calling free()
Diffstat (limited to 'src')
-rw-r--r-- | src/opendeco-cli.c | 8 | ||||
-rw-r--r-- | src/opendeco-conf.c | 8 |
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; } |