lib/repo.c: fix two memleaks in error paths found by clang.

This commit is contained in:
Juan RP 2014-04-19 16:07:29 +02:00
parent 4bc6ba2b1c
commit ada3483acc

View File

@ -80,6 +80,9 @@ repo_get_dict(struct xbps_repo *repo)
if (rv == ARCHIVE_EOF) if (rv == ARCHIVE_EOF)
break; break;
if (rv != ARCHIVE_OK) { if (rv != ARCHIVE_OK) {
if (adata != NULL)
free(adata);
xbps_dbg_printf(repo->xhp, xbps_dbg_printf(repo->xhp,
"%s: read_data_block %s\n", repo->uri, "%s: read_data_block %s\n", repo->uri,
archive_error_string(repo->ar)); archive_error_string(repo->ar));
@ -128,8 +131,10 @@ xbps_repo_open(struct xbps_handle *xhp, const char *url)
/* remote repository */ /* remote repository */
char *rpath; char *rpath;
if ((rpath = xbps_get_remote_repo_string(url)) == NULL) if ((rpath = xbps_get_remote_repo_string(url)) == NULL) {
free(repo);
return NULL; return NULL;
}
repofile = xbps_xasprintf("%s/%s/%s-repodata", xhp->metadir, rpath, arch); repofile = xbps_xasprintf("%s/%s/%s-repodata", xhp->metadir, rpath, arch);
free(rpath); free(rpath);
repo->is_remote = true; repo->is_remote = true;