Skip to content

Commit 147f9ab

Browse files
Chandra Prataprustyrussell
authored andcommitted
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.
1 parent 94c1cf5 commit 147f9ab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

common/daemon_conn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ struct daemon_conn *daemon_conn_new_(const tal_t *ctx, int fd,
143143
void (*outq_empty)(void *),
144144
void *arg)
145145
{
146-
struct daemon_conn *dc = tal(NULL, struct daemon_conn);
146+
struct daemon_conn *dc = tal(ctx, struct daemon_conn);
147147

148148
dc->recv = recv;
149149
dc->outq_empty = outq_empty;

0 commit comments

Comments
 (0)