pay: Fix a memory leak when retrying getroute

This commit is contained in:
Christian Decker 2022-07-05 12:10:41 +02:00 committed by neil saitug
parent 645b1b505b
commit 2632cddfe4

View file

@ -809,6 +809,10 @@ static struct command_result *payment_getroute(struct payment *p)
const char *errstr;
struct gossmap *gossmap;
/* If we retry the getroute call we might already have a route, so
* free an eventual stale route. */
p->route = tal_free(p->route);
gossmap = get_gossmap(p->plugin);
dst = gossmap_find_node(gossmap, p->getroute->destination);