Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Fix list/kvlist objects not being cleared of default when reading config
Bryan Drewery committed 12 years ago
commit 67b1152b7d00ba8a38a3bd87fed6e72c00b7a328
parent ac91e3a
1 file changed +9 -2
modified libpkg/pkg_config.c
@@ -293,6 +293,7 @@ static bool parsed = false;
static size_t c_size = NELEM(c);

static void		 pkg_config_kv_free(struct pkg_config_kv *);
+
static void pkg_config_free(struct pkg_config *conf);
static struct pkg_repo	*pkg_repo_new(const char *name, const char *url);

static void
@@ -438,8 +439,11 @@ pkg_object_walk(ucl_object_t *obj, struct pkg_config *conf_by_key)
					    " ignoring...", key);
					continue;
				}
-
				if (!conf->fromenv)
+
				if (!conf->fromenv) {
+
					pkg_config_free(conf);
+
					conf->list = NULL;
					obj_walk_array(cur, conf);
+
				}
				break;
			case PKG_CONFIG_KVLIST:
				if (cur->type != UCL_OBJECT) {
@@ -447,8 +451,11 @@ pkg_object_walk(ucl_object_t *obj, struct pkg_config *conf_by_key)
					    " ignoring...", key);
					continue;
				}
-
				if (!conf->fromenv)
+
				if (!conf->fromenv) {
+
					pkg_config_free(conf);
+
					conf->kvlist = NULL;
					obj_walk_object(cur, conf);
+
				}
				break;
			}
		}