From abf911af22729858cc876231e7970eff6aefbb9d Mon Sep 17 00:00:00 2001 From: Pavel Knoblokh Date: Wed, 4 Feb 2026 21:59:21 -0600 Subject: [PATCH] pkg: Fix mirror type parsing and service discovery Signed-off-by: Pavel Knoblokh Reviewed by: emaste, imp, kevans Fixes: dc4581589a3 ("pkg: clean support for repositories") Closes: https://github.com/freebsd/freebsd-src/pull/1989 --- usr.sbin/pkg/config.c | 3 ++- usr.sbin/pkg/pkg.c | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/usr.sbin/pkg/config.c b/usr.sbin/pkg/config.c index 6649e75b7f6..8405a4c658f 100644 --- a/usr.sbin/pkg/config.c +++ b/usr.sbin/pkg/config.c @@ -328,7 +328,8 @@ parse_mirror_type(struct repository *r, const char *mt) { if (strcasecmp(mt, "srv") == 0) r->mirror_type = MIRROR_SRV; - r->mirror_type = MIRROR_NONE; + else + r->mirror_type = MIRROR_NONE; } static void diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c index 7b0a67e69a4..33a404474cf 100644 --- a/usr.sbin/pkg/pkg.c +++ b/usr.sbin/pkg/pkg.c @@ -334,6 +334,12 @@ fetch_to_fd(struct repository *repo, const char *url, char *path, const char *fe } cleanup: + fetchFreeURL(u); + while (mirrors != NULL) { + current = mirrors; + mirrors = mirrors->next; + free(current); + } if (remote != NULL) fclose(remote);