xbps_transaction_package_replace: fix a resource leak (CID #98688).

This commit is contained in:
Juan RP 2015-07-26 08:15:07 +02:00
parent 7d7f08b559
commit 28f01b3836

View File

@ -121,8 +121,12 @@ xbps_transaction_package_replace(struct xbps_handle *xhp, xbps_array_t pkgs)
*/ */
xbps_dictionary_set_cstring_nocopy(instd, xbps_dictionary_set_cstring_nocopy(instd,
"transaction", "remove"); "transaction", "remove");
if (!xbps_array_add_first(pkgs, instd)) if (!xbps_array_add_first(pkgs, instd)) {
xbps_object_iterator_release(iter);
free(pkgname);
free(curpkgname);
return EINVAL; return EINVAL;
}
free(curpkgname); free(curpkgname);
} }
xbps_object_iterator_release(iter); xbps_object_iterator_release(iter);