[experimental-ims] 4bbbc69 In theory diag_bitmap could change between (non-)assignment to t0 and use of t0. Always initialize t0 to something.

Poul-Henning Kamp phk at FreeBSD.org
Thu Dec 18 10:27:41 CET 2014


commit 4bbbc69324104deaac64d3845237f0c95ec625f4
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Mar 14 21:24:42 2012 +0000

    In theory diag_bitmap could change between (non-)assignment to t0
    and use of t0.  Always initialize t0 to something.
    
    Correctly spotted by:	FlexeLint

diff --git a/bin/varnishd/cache/cache_lck.c b/bin/varnishd/cache/cache_lck.c
index 3bbbfbb..993bb5e 100644
--- a/bin/varnishd/cache/cache_lck.c
+++ b/bin/varnishd/cache/cache_lck.c
@@ -64,7 +64,7 @@ Lck__Lock(struct lock *lck, const char *p, const char *f, int l)
 {
 	struct ilck *ilck;
 	int r;
-	double t0, t;
+	double t0 = 0, t;
 
 	CAST_OBJ_NOTNULL(ilck, lck->priv, ILCK_MAGIC);
 	if (!(cache_param->diag_bitmap & 0x98)) {



More information about the varnish-commit mailing list