From 2a6cba879290f9f3c073a27bed45d74823cdb6d5 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Wed, 10 Sep 2025 16:06:11 +0200 Subject: [PATCH] unix-socket: address scan-build warning CC unix-manager.o unix-manager.c:258:13: warning: Use of memory after it is freed [unix.Malloc] 258 | if (item->fd == fd) { | ^~~~~~~~ 1 warning generated. (cherry picked from commit 39dfcaf1b35666dfdf4371d1f16b1e2d659698b3) --- src/unix-manager.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/unix-manager.c b/src/unix-manager.c index cc214cc4c5..01235658f2 100644 --- a/src/unix-manager.c +++ b/src/unix-manager.c @@ -252,9 +252,10 @@ static void UnixClientFree(UnixClient *c) static void UnixCommandClose(UnixCommand *this, int fd) { UnixClient *item; + UnixClient *safe = NULL; int found = 0; - TAILQ_FOREACH(item, &this->clients, next) { + TAILQ_FOREACH_SAFE (item, &this->clients, next, safe) { if (item->fd == fd) { found = 1; break;