Skip to content

Commit 2a6cba8

Browse files
committed
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 39dfcaf)
1 parent 99fd698 commit 2a6cba8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/unix-manager.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,10 @@ static void UnixClientFree(UnixClient *c)
252252
static void UnixCommandClose(UnixCommand *this, int fd)
253253
{
254254
UnixClient *item;
255+
UnixClient *safe = NULL;
255256
int found = 0;
256257

257-
TAILQ_FOREACH(item, &this->clients, next) {
258+
TAILQ_FOREACH_SAFE (item, &this->clients, next, safe) {
258259
if (item->fd == fd) {
259260
found = 1;
260261
break;

0 commit comments

Comments
 (0)