MINOR: ssl: use __objt_* variant when retrieving counters

Use non-checked function to retrieve listener/server via obj_type. This
is done as a previous obj_type function ensure that the type is well
known and the instance is not NULL.

Incidentally, this should prevent the coverity report from the #1335
github issue which warns about a possible NULL dereference.
This commit is contained in:
Amaury Denoyelle 2021-07-26 09:59:06 +02:00
parent 1f923391d1
commit 2bf5d41ada
1 changed files with 2 additions and 2 deletions

View File

@ -5389,14 +5389,14 @@ static int ssl_sock_handshake(struct connection *conn, unsigned int flag)
/* get counters */
switch (obj_type(conn->target)) {
case OBJ_TYPE_LISTENER:
li = objt_listener(conn->target);
li = __objt_listener(conn->target);
counters = EXTRA_COUNTERS_GET(li->extra_counters, &ssl_stats_module);
counters_px = EXTRA_COUNTERS_GET(li->bind_conf->frontend->extra_counters_fe,
&ssl_stats_module);
break;
case OBJ_TYPE_SERVER:
srv = objt_server(conn->target);
srv = __objt_server(conn->target);
counters = EXTRA_COUNTERS_GET(srv->extra_counters, &ssl_stats_module);
counters_px = EXTRA_COUNTERS_GET(srv->proxy->extra_counters_be,
&ssl_stats_module);