xbps_check_is_installed_pkg: fix a leak in error paths reported by valgrind.

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091023091157-h3tlqw2nz67m72ep
This commit is contained in:
Juan RP 2009-10-23 11:11:57 +02:00
parent 1e792e62f8
commit 236b86ae50

View File

@ -134,13 +134,16 @@ xbps_check_is_installed_pkg(const char *pkg)
* unpacked or something else. * unpacked or something else.
*/ */
if (xbps_get_pkg_state_installed(pkgname, &state) != 0) { if (xbps_get_pkg_state_installed(pkgname, &state) != 0) {
prop_object_release(dict);
free(pkgname); free(pkgname);
return -1; return -1;
} }
free(pkgname); free(pkgname);
if (state != XBPS_PKG_STATE_INSTALLED) if (state != XBPS_PKG_STATE_INSTALLED) {
prop_object_release(dict);
return -1; return -1;
}
/* Get version from installed package */ /* Get version from installed package */
prop_dictionary_get_cstring_nocopy(dict, "version", &instver); prop_dictionary_get_cstring_nocopy(dict, "version", &instver);