From 5d930fed0cff09d7fc22c2b1152506c334a08f7a Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Sat, 21 Feb 2026 12:20:51 +0100 Subject: irmd: Fix memleak in reg tests Call freebuf(pbuf) before returning from each test thread function. Since clrbuf zeroes pbuf.data to NULL on the success path, free(NULL) is safe. On the failure path of reg_respond_*, it now properly frees the still-allocated data. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- src/irmd/reg/tests/reg_test.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/irmd/reg/tests/reg_test.c') diff --git a/src/irmd/reg/tests/reg_test.c b/src/irmd/reg/tests/reg_test.c index eb981349..b426c0dd 100644 --- a/src/irmd/reg/tests/reg_test.c +++ b/src/irmd/reg/tests/reg_test.c @@ -197,6 +197,8 @@ static void * test_flow_respond_alloc(void * o) reg_respond_alloc(info, &pbuf, response); + freebuf(pbuf); + return (void *) 0; fail: return (void *) -1; @@ -216,6 +218,8 @@ static void * test_flow_respond_accept(void * o) reg_respond_accept(info, &pbuf); + freebuf(pbuf); + return (void *) 0; fail: return (void *) -1; -- cgit v1.2.3