[libvirt] [PATCH] tests: initialize some variables

Ján Tomko jtomko at redhat.com
Wed May 30 08:13:25 UTC 2018


Found by cppcheck:
[tests/metadatatest.c:284]: (error) Uninitialized variable: test
[tests/objecteventtest.c:855]: (error) Uninitialized variable: test

Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 tests/metadatatest.c    | 2 +-
 tests/objecteventtest.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/metadatatest.c b/tests/metadatatest.c
index d5a6f37119..b17a85c883 100644
--- a/tests/metadatatest.c
+++ b/tests/metadatatest.c
@@ -268,7 +268,7 @@ testTextMetadata(const void *data)
 static int
 mymain(void)
 {
-    struct metadataTest test;
+    struct metadataTest test = { 0 };
     int ret = EXIT_SUCCESS;
 
     if (!(test.conn = virConnectOpen("test:///default")))
diff --git a/tests/objecteventtest.c b/tests/objecteventtest.c
index 4b12572eb4..e6de11ec39 100644
--- a/tests/objecteventtest.c
+++ b/tests/objecteventtest.c
@@ -835,7 +835,7 @@ timeout(int id ATTRIBUTE_UNUSED, void *opaque ATTRIBUTE_UNUSED)
 static int
 mymain(void)
 {
-    objecteventTest test;
+    objecteventTest test = { 0 };
     int ret = EXIT_SUCCESS;
     int timer;
 
-- 
2.16.1




More information about the libvir-list mailing list