diff --git a/lib/transaction_package_replace.c b/lib/transaction_package_replace.c index 087f88d3..d8f898de 100644 --- a/lib/transaction_package_replace.c +++ b/lib/transaction_package_replace.c @@ -121,8 +121,12 @@ xbps_transaction_package_replace(struct xbps_handle *xhp, xbps_array_t pkgs) */ xbps_dictionary_set_cstring_nocopy(instd, "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; + } free(curpkgname); } xbps_object_iterator_release(iter);