xbps-rindex/index-clean: fix a minor resource leak (CID #98689).

This commit is contained in:
Juan RP 2015-07-26 08:38:12 +02:00
parent 78f9a97980
commit ffbdfeef63

View File

@ -109,9 +109,10 @@ index_clean(struct xbps_handle *xhp, const char *repodir)
repo = xbps_repo_open(xhp, repodir); repo = xbps_repo_open(xhp, repodir);
if (repo == NULL) { if (repo == NULL) {
rv = errno; rv = errno;
if (rv == ENOENT) if (rv == ENOENT) {
xbps_repo_unlock(rlockfd, rlockfname);
return 0; return 0;
}
fprintf(stderr, "%s: cannot read repository data: %s\n", fprintf(stderr, "%s: cannot read repository data: %s\n",
_XBPS_RINDEX, strerror(errno)); _XBPS_RINDEX, strerror(errno));
xbps_repo_unlock(rlockfd, rlockfname); xbps_repo_unlock(rlockfd, rlockfname);