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.
*/
static int ssl_sock_handshake(struct connection *conn, unsigned int flag)
{
- struct ssl_sock_ctx *ctx = conn_get_ssl_sock_ctx(conn);
+ struct ssl_sock_ctx *ctx;
int ret;
struct ssl_counters *counters = NULL;
struct ssl_counters *counters_px = NULL;
if (!conn_ctrl_ready(conn))
return 0;
+ ctx = conn_get_ssl_sock_ctx(conn);
if (!ctx)
goto out_error;