bin/xbps-query: fix memory leak in --list-repos

This commit is contained in:
Duncan Overbruck 2022-01-25 19:44:41 +01:00
parent 24cb1709c7
commit 65afbadf08
No known key found for this signature in database
GPG Key ID: 335C1D17EC3D6E35

View File

@ -216,18 +216,17 @@ repo_list_uri_err(const char *repouri)
int
repo_list(struct xbps_handle *xhp)
{
struct xbps_repo *repo = NULL;
const char *repouri = NULL;
for (unsigned int i = 0; i < xbps_array_count(xhp->repositories); i++) {
const char *repouri = NULL;
struct xbps_repo *repo;
xbps_array_get_cstring_nocopy(xhp->repositories, i, &repouri);
repo = xbps_repo_open(xhp, repouri);
if (repo) {
repo_list_uri(repo);
xbps_repo_close(repo);
} else {
if (!repo) {
repo_list_uri_err(repouri);
continue;
}
repo_list_uri(repo);
xbps_repo_release(repo);
}
return 0;
}