From 1a1b47b8f7558f881a22586fd8aec87a4ea67851 Mon Sep 17 00:00:00 2001 From: Chandra Pratap Date: Mon, 7 Jul 2025 05:43:39 +0000 Subject: [PATCH] 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. --- common/daemon_conn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/daemon_conn.c b/common/daemon_conn.c index e775544cc85b..aad01e933115 100644 --- a/common/daemon_conn.c +++ b/common/daemon_conn.c @@ -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;