diff options
| author | Dimitri Staessens <dimitri@ouroboros.rocks> | 2026-02-21 12:20:51 +0100 |
|---|---|---|
| committer | Sander Vrijders <sander@ouroboros.rocks> | 2026-02-22 16:06:49 +0100 |
| commit | 5d930fed0cff09d7fc22c2b1152506c334a08f7a (patch) | |
| tree | cfa851ad2a76f9f63a977f89c914c8b59706b2a9 /src/irmd/reg | |
| parent | 83533c990793b18628066196916851e6b34792df (diff) | |
| download | ouroboros-testing.tar.gz ouroboros-testing.zip | |
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 <dimitri@ouroboros.rocks>
Signed-off-by: Sander Vrijders <sander@ouroboros.rocks>
Diffstat (limited to 'src/irmd/reg')
| -rw-r--r-- | src/irmd/reg/reg.c | 4 | ||||
| -rw-r--r-- | src/irmd/reg/tests/reg_test.c | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/irmd/reg/reg.c b/src/irmd/reg/reg.c index 0025f695..9ee47221 100644 --- a/src/irmd/reg/reg.c +++ b/src/irmd/reg/reg.c @@ -2008,7 +2008,11 @@ int reg_respond_accept(struct flow_info * info, info->n_pid = flow->info.n_pid; +<<<<<<< HEAD flow->req_data = *pbuf; +======= + reg_flow_set_data(flow, pbuf); +>>>>>>> c82f0de4 (irmd: Fix memleak in reg tests) clrbuf(*pbuf); if (reg_flow_update(flow, info) < 0) { 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; |
