aboutsummaryrefslogtreecommitdiff
path: root/gmid.c
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-06-12 10:19:17 +0000
committerOmar Polo <op@omarpolo.com>2021-06-12 10:19:17 +0000
commit3b33eab3ad8f82f967e201ab77e16ff28cb76e8e (patch)
treeaf97c3f300b28503ebecd5f3b6a230b28d286100 /gmid.c
parenta6c809551e8dd554898a041a00d13b03a91d77cd (diff)
TAILQ_REMOVE env and aliases during config_free
it's not technically required, since a couple of lines below we free whole host struct, and we don't have code that may use h->{env,aliases} afterwards, but it's nice not to have invalid pointers around. it may bite in the future.
Diffstat (limited to 'gmid.c')
-rw-r--r--gmid.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gmid.c b/gmid.c
index e04e172..c4777f5 100644
--- a/gmid.c
+++ b/gmid.c
@@ -281,12 +281,16 @@ free_config(void)
}
TAILQ_FOREACH_SAFE(e, &h->env, envs, te) {
+ TAILQ_REMOVE(&h->env, e, envs);
+
free(e->name);
free(e->value);
free(e);
}
TAILQ_FOREACH_SAFE(a, &h->aliases, aliases, ta) {
+ TAILQ_REMOVE(&h->aliases, a, aliases);
+
free(a->alias);
free(a);
}