common: fix dangling memory allocation in daemon_conn_new_()
Changelog-Fixed: Use the correct context in `daemon_conn_new_()` by allocating `struct daemon_conn` with `ctx` instead of `NULL`. This ensures proper ownership and cleanup of `daemon_conn` objects, avoiding memory leaks.
This commit is contained in:
committed by
Rusty Russell
parent
f7f018fea9
commit
c0673aeac4
@@ -143,7 +143,7 @@ struct daemon_conn *daemon_conn_new_(const tal_t *ctx, int fd,
|
||||
void (*outq_empty)(void *),
|
||||
void *arg)
|
||||
{
|
||||
struct daemon_conn *dc = tal(NULL, struct daemon_conn);
|
||||
struct daemon_conn *dc = tal(ctx, struct daemon_conn);
|
||||
|
||||
dc->recv = recv;
|
||||
dc->outq_empty = outq_empty;
|
||||
|
||||
Reference in New Issue
Block a user