From 835834ff73585ce38d1ae0416865b8c1b45777c9 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Mon, 10 Feb 2020 09:07:00 +0100 Subject: [PATCH] xbps_repo_open: fix memleak in error paths. --- lib/repo.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/repo.c b/lib/repo.c index 1cfb6486..fda4f1e8 100644 --- a/lib/repo.c +++ b/lib/repo.c @@ -156,6 +156,7 @@ repo_open_local(struct xbps_repo *repo, const char *repofile) xbps_dbg_printf(repo->xhp, "[repo] `%s' failed to open repodata archive %s\n", repofile, strerror(rv)); + xbps_repo_close(repo); return false; } if ((repo->idx = repo_get_dict(repo)) == NULL) { @@ -163,6 +164,7 @@ repo_open_local(struct xbps_repo *repo, const char *repofile) " index on archive, removing file.\n", repofile); /* broken archive, remove it */ (void)unlink(repofile); + xbps_repo_close(repo); return false; } xbps_dictionary_make_immutable(repo->idx);