From b5b4dbf2c253f035dc40928fe9d554fe7bbd4d97 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 13 Nov 2025 15:40:31 +1030 Subject: [PATCH] askrene: fix error path if we fail sanity checks. We've already freed the working_ctx, and the fail path does that again. Signed-off-by: Rusty Russell --- plugins/askrene/mcf.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/plugins/askrene/mcf.c b/plugins/askrene/mcf.c index 3acf0a332..44cdfc728 100644 --- a/plugins/askrene/mcf.c +++ b/plugins/askrene/mcf.c @@ -1618,24 +1618,21 @@ linear_routes(const tal_t *ctx, struct route_query *rq, rq_log(rq, rq, LOG_BROKEN, "%s: check_htlc_min_limits failed", __func__); *flows = tal_free(*flows); - goto fail; + return error_message; } if (!check_htlc_max_limits(rq, *flows)) { - error_message = - rq_log(rq, rq, LOG_BROKEN, - "%s: check_htlc_max_limits failed", __func__); *flows = tal_free(*flows); - goto fail; + return rq_log(rq, rq, LOG_BROKEN, + "%s: check_htlc_max_limits failed", __func__); } if (tal_count(*flows) > rq->maxparts) { - error_message = rq_log( - rq, rq, LOG_BROKEN, - "%s: the number of flows (%zu) exceeds the limit set " - "on payment parts (%" PRIu32 - "), please submit a bug report", - __func__, tal_count(*flows), rq->maxparts); + size_t num_flows = tal_count(*flows); *flows = tal_free(*flows); - goto fail; + return rq_log(rq, rq, LOG_BROKEN, + "%s: the number of flows (%zu) exceeds the limit set " + "on payment parts (%" PRIu32 + "), please submit a bug report", + __func__, num_flows, rq->maxparts); } return NULL;