[master] d72f3bb Add more paranoia.

Poul-Henning Kamp phk at varnish-cache.org
Tue Nov 5 22:18:02 CET 2013


commit d72f3bbbafa32ca90d5d95d71785bf6973f1cdd9
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Nov 5 21:17:52 2013 +0000

    Add more paranoia.

diff --git a/bin/varnishd/cache/cache_http1_fetch.c b/bin/varnishd/cache/cache_http1_fetch.c
index 57384f3..bd1cc47 100644
--- a/bin/varnishd/cache/cache_http1_fetch.c
+++ b/bin/varnishd/cache/cache_http1_fetch.c
@@ -421,7 +421,6 @@ V1F_fetch_body(struct worker *wrk, struct busyobj *bo)
 
 	if (bo->state == BOS_FAILED) {
 		wrk->stats.fetch_failed++;
-		obj->len = 0;
 	} else {
 		assert(bo->state == BOS_FETCHING);
 
diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c
index b7bd8d8..739d7ab 100644
--- a/bin/varnishd/cache/cache_obj.c
+++ b/bin/varnishd/cache/cache_obj.c
@@ -65,6 +65,7 @@ ObjIter(struct objiter *oi, void **p, ssize_t *l)
 	ssize_t nl;
 
 	CHECK_OBJ_NOTNULL(oi, OBJITER_MAGIC);
+	CHECK_OBJ_NOTNULL(oi->obj, OBJECT_MAGIC);
 	AN(p);
 	AN(l);
 	*p = NULL;
@@ -105,6 +106,7 @@ ObjIter(struct objiter *oi, void **p, ssize_t *l)
 			ol -= oi->st->len;
 			nl -= oi->st->len;
 		}
+		CHECK_OBJ_NOTNULL(oi->obj, OBJECT_MAGIC);
 		CHECK_OBJ_NOTNULL(oi->st, STORAGE_MAGIC);
 		oi->st = VTAILQ_NEXT(oi->st, list);
 		if (oi->st != NULL && oi->st->len == 0)
@@ -121,6 +123,7 @@ ObjIterEnd(struct objiter **oi)
 
 	AN(oi);
 	CHECK_OBJ_NOTNULL((*oi), OBJITER_MAGIC);
+	CHECK_OBJ_NOTNULL((*oi)->obj, OBJECT_MAGIC);
 	if ((*oi)->bo != NULL)
 		VBO_DerefBusyObj((*oi)->wrk, &(*oi)->bo);
 	FREE_OBJ((*oi));
diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c
index aa5d7eb..5d91630 100644
--- a/bin/varnishd/storage/stevedore.c
+++ b/bin/varnishd/storage/stevedore.c
@@ -77,6 +77,7 @@ default_oc_freeobj(struct objcore *oc)
 	CAST_OBJ_NOTNULL(o, oc->priv, OBJECT_MAGIC);
 	oc->priv = NULL;
 	oc->methods = NULL;
+	o->magic = 0;
 
 	STV_Freestore(o);
 	STV_free(o->objstore);



More information about the varnish-commit mailing list