Skip to content

Commit

Permalink
subd: fix parent of subd.
Browse files Browse the repository at this point in the history
5c949e3 ("subd: make channel/peer own the subd.")
added a ctx arg, but in fact we steal the subd onto the conn, which is still
allocated off ld!

Hence the memleak that was supposed to fix turned up again in CI!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
rustyrussell committed Mar 31, 2022
1 parent 9f4dfc8 commit 5f89486
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lightningd/subd.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ static struct subd *new_subd(const tal_t *ctx,
const char *happenings),
va_list *ap)
{
struct subd *sd = tal(ctx, struct subd);
struct subd *sd = tal(NULL, struct subd);
int msg_fd;
const char *debug_subd = NULL;
const char *shortname;
Expand Down Expand Up @@ -770,7 +770,7 @@ static struct subd *new_subd(const tal_t *ctx,
sd->node_id = tal_dup_or_null(sd, struct node_id, node_id);

/* conn actually owns daemon: we die when it does. */
sd->conn = io_new_conn(ld, msg_fd, msg_setup, sd);
sd->conn = io_new_conn(ctx, msg_fd, msg_setup, sd);
tal_steal(sd->conn, sd);

log_peer_debug(sd->log, node_id, "pid %u, msgfd %i", sd->pid, msg_fd);
Expand Down

0 comments on commit 5f89486

Please sign in to comment.