diff --git a/usr.sbin/pkg/config.c b/usr.sbin/pkg/config.c --- a/usr.sbin/pkg/config.c +++ b/usr.sbin/pkg/config.c @@ -479,6 +479,7 @@ const char *abi = pkg_get_myabi(); char *major, *minor; struct utsname uts; + int ret; if (uname(&uts)) err(EXIT_FAILURE, "uname"); @@ -502,9 +503,9 @@ if (errno != ENOENT) errx(EXIT_FAILURE, "Unable to parse configuration " "file %s: %s", confpath, ucl_parser_get_error(p)); - ucl_parser_free(p); /* no configuration present */ - return (1); + ret = 1; + goto out; } obj = ucl_parser_get_object(p); @@ -517,13 +518,16 @@ else if (conftype == CONFFILE_REPO) parse_repo_file(obj, requested_repo); } - ucl_object_unref(obj); + + ret = 0; +out: ucl_parser_free(p); + free(abi); free(major); free(minor); - return (0); + return (ret); } static void @@ -674,7 +678,7 @@ { if (STAILQ_EMPTY(&repositories)) { /* Fall back to PACKAGESITE - deprecated - */ - struct repository *r = calloc(1, sizeof(r)); + struct repository *r = calloc(1, sizeof(*r)); if (r == NULL) err(EXIT_FAILURE, "calloc"); r->name = strdup("fallback"); diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c --- a/usr.sbin/pkg/pkg.c +++ b/usr.sbin/pkg/pkg.c @@ -664,7 +664,7 @@ pubkey = r->pubkey; } else { if (config_string(PUBKEY, &pubkey) != 0) { - warnx("No CONFIG_PUBKEY defined for %s", r->name); + warnx("No CONFIG_PUBKEY defined"); goto cleanup; } }