xbps_repo_open: fix memleak in error paths.
This commit is contained in:
parent
02c9cb11c4
commit
835834ff73
@ -156,6 +156,7 @@ repo_open_local(struct xbps_repo *repo, const char *repofile)
|
|||||||
xbps_dbg_printf(repo->xhp,
|
xbps_dbg_printf(repo->xhp,
|
||||||
"[repo] `%s' failed to open repodata archive %s\n",
|
"[repo] `%s' failed to open repodata archive %s\n",
|
||||||
repofile, strerror(rv));
|
repofile, strerror(rv));
|
||||||
|
xbps_repo_close(repo);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((repo->idx = repo_get_dict(repo)) == NULL) {
|
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);
|
" index on archive, removing file.\n", repofile);
|
||||||
/* broken archive, remove it */
|
/* broken archive, remove it */
|
||||||
(void)unlink(repofile);
|
(void)unlink(repofile);
|
||||||
|
xbps_repo_close(repo);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
xbps_dictionary_make_immutable(repo->idx);
|
xbps_dictionary_make_immutable(repo->idx);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user