From 9f95c0229c827ee867f265318899e347df2004ad Mon Sep 17 00:00:00 2001
From: Martin Blix Grydeland <martin@varnish-software.com>
Date: Wed, 20 Aug 2025 13:21:34 +0200
Subject: H2: Add sanity assertions to h2_send_get_locked()

These assertions guard against double-registering on the send queue.

diff --git a/bin/varnishd/http2/cache_http2_send.c b/bin/varnishd/http2/cache_http2_send.c
index 3461bdb380..6208633853 100644
--- a/bin/varnishd/http2/cache_http2_send.c
+++ b/bin/varnishd/http2/cache_http2_send.c
@@ -107,6 +107,8 @@ h2_send_get_locked(struct worker *wrk, struct h2_sess *h2, struct h2_req *r2)
 	Lck_AssertHeld(&h2->sess->mtx);
 	if (&wrk->cond == h2->cond)
 		ASSERT_RXTHR(h2);
+	AZ(H2_SEND_HELD(h2, r2));
+	AZ(r2->wrk);
 	r2->wrk = wrk;
 	VTAILQ_INSERT_TAIL(&h2->txqueue, r2, tx_list);
 	while (!H2_SEND_HELD(h2, r2))
