]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: Fix a maybe-uninitialised compiler warning (#5269)
authorPhilip Withnall <philip@tecnocode.co.uk>
Wed, 8 Feb 2017 15:53:01 +0000 (15:53 +0000)
committerLennart Poettering <lennart@poettering.net>
Wed, 8 Feb 2017 15:53:01 +0000 (16:53 +0100)
The compiler warning is a false positive, since n_addresses is always
initialised on the success path from parse_argv(), but the compiler
obviously can’t work that out.

Fixes:
   src/test/test-nss.c:426:9: warning: 'n_addresses' may be used uninitialized in this function [-Wmaybe-uninitialized]

src/test/test-nss.c

index 4ccfe751473e13643dd59856a4259a2aadb8feb9..b59cb7aa694478c4d3f6e0b34046b193ea68cb3c 100644 (file)
@@ -511,7 +511,7 @@ int main(int argc, char **argv) {
         _cleanup_free_ char *dir = NULL;
         _cleanup_strv_free_ char **modules = NULL, **names = NULL;
         _cleanup_free_ struct local_address *addresses = NULL;
-        int n_addresses;
+        int n_addresses = 0;
         char **module;
         int r;