]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: peers: remove an unneeded null check
authorWilly Tarreau <w@1wt.eu>
Fri, 14 Nov 2025 12:46:00 +0000 (13:46 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 14 Nov 2025 12:47:20 +0000 (13:47 +0100)
Coverity reported in GH #3181 that a NULL test was useless, in
peers_trace(), which is true since the peer always belongs to a
peers section and it was already dereferenced. Let's just remove
the test to avoid the confusion.

src/peers.c

index 9a97ebb6bd599c9dd04dfa90c44f45c8e33b5313..e7074c6af6fd8461a4d81fe7692be0f71e81d525 100644 (file)
@@ -449,9 +449,8 @@ static void peers_trace(enum trace_level level, uint64_t mask,
                chunk_appendf(&trace_buf, "appctx=(%p, .fl=0x%08x, .st0=%d, .st1=%d) ",
                              appctx, appctx->flags, appctx->st0, appctx->st1);
 
-       if (peers)
-               chunk_appendf(&trace_buf, "peers=(.fl=0x%08x, local=%s) ",
-                             peers->flags, peers->local->id);
+       chunk_appendf(&trace_buf, "peers=(.fl=0x%08x, local=%s) ",
+                     peers->flags, peers->local->id);
 
        if (src->verbosity == PEERS_VERB_SIMPLE)
                return;