diff --git a/src/shared/varlink.c b/src/shared/varlink.c index f9c7f2e659..ce9cf73646 100644 --- a/src/shared/varlink.c +++ b/src/shared/varlink.c @@ -2285,6 +2285,10 @@ static int collect_callback( /* If we hit an error, we will drop all collected replies and just return the error_id and flags in varlink_collect() */ if (error_id) { context->error_id = error_id; + + json_variant_unref(context->parameters); + context->parameters = json_variant_ref(parameters); + return 0; } @@ -2337,6 +2341,8 @@ int varlink_collect( /* If we get an error from any of the replies, return immediately with just the error_id and flags*/ if (context.error_id) { + if (ret_parameters) + *ret_parameters = TAKE_PTR(context.parameters); if (ret_error_id) *ret_error_id = TAKE_PTR(context.error_id); if (ret_flags)