From 208008d717567f1a3a096d5775356a67d8dd6517 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Wed, 10 Jan 2024 16:41:03 +0100 Subject: config: fix cloning of env_vars tllist When cloning a config struct, the env_vars tllist wasn't correctly copied. We did correctly iterate and duplicate all old entries, but we did *not* reset the list in the cloned struct before doing so. This meant the list contained entries shared with the original list, causing double free:s in --server mode. --- config.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'config.c') diff --git a/config.c b/config.c index e5cd6723..de15add3 100644 --- a/config.c +++ b/config.c @@ -3393,6 +3393,8 @@ config_clone(const struct config *old) key_binding_list_clone(&conf->bindings.url, &old->bindings.url); key_binding_list_clone(&conf->bindings.mouse, &old->bindings.mouse); + conf->env_vars.length = 0; + conf->env_vars.head = conf->env_vars.tail = NULL; tll_foreach(old->env_vars, it) { struct env_var copy = { .name = xstrdup(it->item.name), -- cgit v1.3