[master] 5eb7124 Add some asserts for Flexelint and general paranoia

Poul-Henning Kamp phk at FreeBSD.org
Tue Nov 1 12:46:04 CET 2016


commit 5eb7124955b048a55372e7f335cc00ce03fb7ec2
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Nov 1 10:35:37 2016 +0000

    Add some asserts for Flexelint and general paranoia

diff --git a/bin/varnishd/storage/storage_persistent.c b/bin/varnishd/storage/storage_persistent.c
index af9e46b..730f2d6 100644
--- a/bin/varnishd/storage/storage_persistent.c
+++ b/bin/varnishd/storage/storage_persistent.c
@@ -531,6 +531,10 @@ smp_allocobj(struct worker *wrk, const struct stevedore *stv,
 	ltot = sizeof(struct object) + PRNDUP(wsl);
 	ltot = IRNUP(sc, ltot);
 
+	st = NULL;
+	sg = NULL;
+	so = NULL;
+	objidx = 0;
 	for (; nuke_limit >= 0; nuke_limit--) {
 		st = smp_allocx(stv, ltot, ltot, &so, &objidx, &sg);
 		if (st != NULL && st->space < ltot) {
@@ -544,6 +548,8 @@ smp_allocobj(struct worker *wrk, const struct stevedore *stv,
 	}
 
 	AN(st);
+	AN(sg);
+	AN(so);
 	assert(st->space >= ltot);
 
 	o = SML_MkObject(stv, oc, st->ptr);



More information about the varnish-commit mailing list