lib/package_configure.c: fix memleak

This commit is contained in:
Duncaen 2016-09-25 18:24:19 +02:00
parent 81673d69c7
commit 4797dee468

View File

@ -111,11 +111,11 @@ xbps_configure_pkg(struct xbps_handle *xhp,
free(pkgname); free(pkgname);
return ENOENT; return ENOENT;
} }
free(pkgname);
rv = xbps_pkg_state_dictionary(pkgd, &state); rv = xbps_pkg_state_dictionary(pkgd, &state);
xbps_dbg_printf(xhp, "%s: state %d rv %d\n", pkgver, state, rv); xbps_dbg_printf(xhp, "%s: state %d rv %d\n", pkgver, state, rv);
if (rv != 0) { if (rv != 0) {
free(pkgname);
xbps_dbg_printf(xhp, "%s: [configure] failed to get " xbps_dbg_printf(xhp, "%s: [configure] failed to get "
"pkg state: %s\n", pkgver, strerror(rv)); "pkg state: %s\n", pkgver, strerror(rv));
return EINVAL; return EINVAL;
@ -124,11 +124,9 @@ xbps_configure_pkg(struct xbps_handle *xhp,
if (check_state) { if (check_state) {
if (state == XBPS_PKG_STATE_INSTALLED) { if (state == XBPS_PKG_STATE_INSTALLED) {
if ((xhp->flags & XBPS_FLAG_FORCE_CONFIGURE) == 0) { if ((xhp->flags & XBPS_FLAG_FORCE_CONFIGURE) == 0) {
free(pkgname);
return 0; return 0;
} }
} else if (state != XBPS_PKG_STATE_UNPACKED) { } else if (state != XBPS_PKG_STATE_UNPACKED) {
free(pkgname);
return EINVAL; return EINVAL;
} }
} }