]> git.kaiwu.me - haproxy.git/commit
BUILD: ssl: avoid a wrong null deref warning in ssl_sock_handshake
authorWilly Tarreau <w@1wt.eu>
Wed, 1 Jul 2026 12:28:18 +0000 (14:28 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 3 Jul 2026 14:32:28 +0000 (16:32 +0200)
commitfa8ca0be4ddd8e120e7c928b7972663527c183ba
tree70a23774bceb5af1aacce9c8ad0545f65d4097c7
parentb17a16b3e2e534f4736e3c911c64f550d9b34def
BUILD: ssl: avoid a wrong null deref warning in ssl_sock_handshake

When disabling traces, "conn" isn't used between ctx assignment and its
first usage, and as usual, gcc wrongly believes that a null check in a
shared function implies the checked argument may be NULL where it's used,
leading to this warning:

  src/ssl_sock.c: In function 'ssl_sock_handshake.constprop':
  src/ssl_sock.c:6049:7: warning: null pointer dereference [-Wnull-dereference]

Assigning ctx after the conn_ctrl_ready() check is sufficient to shut it
up, so let's do this. It should also result in slightly better code.
src/ssl_sock.c