From 4b7d2dc5b8610dedd822d61ebf126acecf335ab0 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Sat, 26 Feb 2022 11:20:33 +1030 Subject: [PATCH] common/bolt11: make decoded routes hang off routes arr, not b11. This causes weirdness in pay, which tal_steal's b11->routes and expects to get it all. Signed-off-by: Rusty Russell --- common/bolt11.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/bolt11.c b/common/bolt11.c index 490c7b9ef..5ec8f8f71 100644 --- a/common/bolt11.c +++ b/common/bolt11.c @@ -442,7 +442,7 @@ static char *decode_r(struct bolt11 *b11, size_t rlen = data_length * 5 / 8; u8 *r8 = tal_arr(tmpctx, u8, rlen); size_t n = 0; - struct route_info *r = tal_arr(tmpctx, struct route_info, n); + struct route_info *r = tal_arr(b11->routes, struct route_info, n); const u8 *cursor = r8; /* Route hops don't split in 5 bit boundaries, so convert whole thing */ @@ -457,7 +457,7 @@ static char *decode_r(struct bolt11 *b11, } while (rlen); /* Append route */ - tal_arr_expand(&b11->routes, tal_steal(b11, r)); + tal_arr_expand(&b11->routes, r); return NULL; }