[master] ec2ec1355 ban: Restore banidx flexelint

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Apr 17 11:03:05 UTC 2025


commit ec2ec1355c255131781ba945077fcc8262144a56
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Thu Apr 17 13:01:58 2025 +0200

    ban: Restore banidx flexelint
    
    Refs 30fca975e4e596a541106997f5cf5f282da164ac

diff --git a/bin/varnishd/cache/cache_ban_idx.c b/bin/varnishd/cache/cache_ban_idx.c
index 11a5886a0..de1b7899a 100644
--- a/bin/varnishd/cache/cache_ban_idx.c
+++ b/bin/varnishd/cache/cache_ban_idx.c
@@ -44,9 +44,6 @@
 
 #include "cache_varnishd.h"
 #include "cache_ban.h"
-#include "cache_objhead.h"
-
-#include "vtree.h"
 
 struct metaban {
 	unsigned		magic;
@@ -58,7 +55,7 @@ struct metaban {
 };
 
 static inline int
-metaban_cmp(const struct metaban *i1, struct metaban *i2)
+metaban_cmp(const struct metaban *i1, const struct metaban *i2)
 {
 	if (i1->time < i2->time)
 		return (-1);
@@ -83,7 +80,8 @@ static pthread_mutex_t banidxmtx = PTHREAD_MUTEX_INITIALIZER;
 struct ban *
 BANIDX_lookup(vtim_real t0)
 {
-	struct metaban *m, needle = {0, .time = t0};
+	struct metaban *m;	//lint -e429 not freed or returned
+	struct metaban needle = {0, .time = t0};
 	struct ban *best = NULL, *b = NULL;
 	vtim_real t1;
 
@@ -114,6 +112,7 @@ BANIDX_lookup(vtim_real t0)
 		if (t1 < t0)
 			break;
 		ALLOC_OBJ(m, BANIDX_MAGIC);
+		AN(m);
 		m->time = t1;
 		m->ban = b;
 		AZ(VRBT_INSERT(banidx_s, &banidx, m));


More information about the varnish-commit mailing list