Skip to content

Commit b5b4dbf

Browse files
committed
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 <rusty@rustcorp.com.au>
1 parent b6c2204 commit b5b4dbf

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

plugins/askrene/mcf.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1618,24 +1618,21 @@ linear_routes(const tal_t *ctx, struct route_query *rq,
16181618
rq_log(rq, rq, LOG_BROKEN,
16191619
"%s: check_htlc_min_limits failed", __func__);
16201620
*flows = tal_free(*flows);
1621-
goto fail;
1621+
return error_message;
16221622
}
16231623
if (!check_htlc_max_limits(rq, *flows)) {
1624-
error_message =
1625-
rq_log(rq, rq, LOG_BROKEN,
1626-
"%s: check_htlc_max_limits failed", __func__);
16271624
*flows = tal_free(*flows);
1628-
goto fail;
1625+
return rq_log(rq, rq, LOG_BROKEN,
1626+
"%s: check_htlc_max_limits failed", __func__);
16291627
}
16301628
if (tal_count(*flows) > rq->maxparts) {
1631-
error_message = rq_log(
1632-
rq, rq, LOG_BROKEN,
1633-
"%s: the number of flows (%zu) exceeds the limit set "
1634-
"on payment parts (%" PRIu32
1635-
"), please submit a bug report",
1636-
__func__, tal_count(*flows), rq->maxparts);
1629+
size_t num_flows = tal_count(*flows);
16371630
*flows = tal_free(*flows);
1638-
goto fail;
1631+
return rq_log(rq, rq, LOG_BROKEN,
1632+
"%s: the number of flows (%zu) exceeds the limit set "
1633+
"on payment parts (%" PRIu32
1634+
"), please submit a bug report",
1635+
__func__, num_flows, rq->maxparts);
16391636
}
16401637

16411638
return NULL;

0 commit comments

Comments
 (0)