[master] f088fc4d9 vnum: Work around uninitialized variable in test code

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Feb 13 19:07:07 UTC 2023


commit f088fc4d943224b5d781a8c4bb3f7e4f82af3b25
Author: William Wilson <william.wilson at canonical.com>
Date:   Tue Jan 31 14:25:06 2023 -0500

    vnum: Work around uninitialized variable in test code
    
    The value should always be set, because we already assign zero on error,
    but it might escape (pun intended) the vigilance of the compiler.
    
    Instead of always making `VNUM_2bytes()` assign its second parameter, it
    was decided that fixing the test case would be enough since we already
    require error handling.

diff --git a/lib/libvarnish/vnum.c b/lib/libvarnish/vnum.c
index 8b90b97c8..021aa7baf 100644
--- a/lib/libvarnish/vnum.c
+++ b/lib/libvarnish/vnum.c
@@ -575,7 +575,7 @@ main(int argc, char *argv[])
 {
 	int ec = 0;
 	struct test_case *tc;
-	uintmax_t val;
+	uintmax_t val = 0;
 	const char **p;
 	const char *e;
 	double d1, d2;


More information about the varnish-commit mailing list