From 253432c918dacc8bfd5d9a6a46c45a9dc682c7ec Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Tue, 3 Nov 2026 02:45:55 +0100 Subject: Give the live sync worker a real workstruct --- src/ot_livesync.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/ot_livesync.c') diff --git a/src/ot_livesync.c b/src/ot_livesync.c index 083fe1a..18dae0d 100644 --- a/src/ot_livesync.c +++ b/src/ot_livesync.c @@ -4,6 +4,7 @@ /* System */ #include #include +#include #include #include #include @@ -200,9 +201,12 @@ static void *livesync_worker(void *args) { (void)args; - /* Initialize our "thread local storage" */ - ws.inbuf = ws.request = malloc(LIVESYNC_INCOMING_BUFFSIZE); - ws.outbuf = ws.reply = 0; + if (workstruct_init(&ws, LIVESYNC_INCOMING_BUFFSIZE) == -1) { + fprintf(stderr, "Warning: live sync could not get its buffers and will not run.\n"); + atomic_store(&thread_left, 1); + return NULL; + } + ws.request = ws.inbuf; while (g_opentracker_running) { uint32_t packet_type; @@ -233,7 +237,7 @@ static void *livesync_worker(void *args) { } } - free(ws.inbuf); + workstruct_deinit(&ws); atomic_store(&thread_left, 1); return NULL; } -- cgit v1.3