]> git.kaiwu.me - haproxy.git/commitdiff
BUILD: mux-quic: silence an invalid null-deref warning at -O1
authorWilly Tarreau <w@1wt.eu>
Tue, 1 Dec 2026 10:52:40 +0000 (11:52 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 1 Dec 2026 12:40:20 +0000 (13:40 +0100)
It's just because it sees that qcs_sc(qcs) can return a NULL, but on
the second call it forgets it just tested it, as usual. Let's pass it
via a local variable.

src/mux_quic.c

index 2c917992899d3f4c9d7216aa4668d22a1983db31..2bf53659f71a85f9d8462a3c1b91dfe18e5c2dbc 100644 (file)
@@ -581,9 +581,11 @@ static struct ncbuf *qcs_get_ncbuf(struct qcs *qcs, struct ncbuf *ncbuf)
 static void qcs_alert(struct qcs *qcs)
 {
        unsigned int state = TASK_WOKEN_MSG;
+       const struct stconn *sc;
 
        TRACE_POINT(QMUX_EV_STRM_WAKE, qcs->qcc->conn, qcs);
-       if (!qcs_sc(qcs))
+       sc = qcs_sc(qcs);
+       if (!sc)
                return;
 
        if (qcs->subs) {
@@ -591,7 +593,7 @@ static void qcs_alert(struct qcs *qcs)
                qcs->subs = NULL;
                state |= TASK_WOKEN_IO;
        }
-       tasklet_wakeup(qcs_sc(qcs)->wait_event.tasklet, state);
+       tasklet_wakeup(sc->wait_event.tasklet, state);
 }
 
 int qcs_subscribe(struct qcs *qcs, int event_type, struct wait_event *es)