]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: stream: address null-deref build warnings at -Wextra
authorWilly Tarreau <w@1wt.eu>
Thu, 20 Sep 2018 09:11:15 +0000 (11:11 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 20 Sep 2018 09:42:15 +0000 (11:42 +0200)
These warnings are caused by the improper use of stktable_data_ptr()
whose result is not checked instead of using __stktable_data_ptr().

src/stream.c

index cc307453aaadbfed4757649af6659d3435c7dc3c..b7eb5db747b52a00e2f28a8be24bd4cf9ac1a5ef 100644 (file)
@@ -1441,7 +1441,7 @@ static int process_sticking_rules(struct stream *s, struct channel *req, int an_
 
                                                /* srv found in table */
                                                HA_RWLOCK_RDLOCK(STK_SESS_LOCK, &ts->lock);
-                                               ptr = stktable_data_ptr(rule->table.t, ts, STKTABLE_DT_SERVER_ID);
+                                               ptr = __stktable_data_ptr(rule->table.t, ts, STKTABLE_DT_SERVER_ID);
                                                node = eb32_lookup(&px->conf.used_server_id, stktable_data_cast(ptr, server_id));
                                                HA_RWLOCK_RDUNLOCK(STK_SESS_LOCK, &ts->lock);
                                                if (node) {
@@ -1568,8 +1568,8 @@ static int process_store_rules(struct stream *s, struct channel *rep, int an_bit
                s->store[i].ts = NULL;
 
                HA_RWLOCK_WRLOCK(STK_SESS_LOCK, &ts->lock);
-               ptr = stktable_data_ptr(s->store[i].table, ts, STKTABLE_DT_SERVER_ID);
-               stktable_data_cast(ptr, server_id) = objt_server(s->target)->puid;
+               ptr = __stktable_data_ptr(s->store[i].table, ts, STKTABLE_DT_SERVER_ID);
+               stktable_data_cast(ptr, server_id) = __objt_server(s->target)->puid;
                HA_RWLOCK_WRUNLOCK(STK_SESS_LOCK, &ts->lock);
                stktable_touch_local(s->store[i].table, ts, 1);
        }