[PATCH 1/3] examples: domtop: Fix uninitialized variable use

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



max_id could be used uninitialized in the cleanup section after the
domain wasn't found.

Discovered by Coverity.
---
 examples/domtop/domtop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/domtop/domtop.c b/examples/domtop/domtop.c
index 8118793..7661057 100644
--- a/examples/domtop/domtop.c
+++ b/examples/domtop/domtop.c
@@ -254,7 +254,7 @@ do_top(virConnectPtr conn,
 {
     int ret = -1;
     virDomainPtr dom;
-    int max_id;
+    int max_id = 0;
     int nparams = 0, then_nparams = 0, now_nparams = 0;
     virTypedParameterPtr then_params = NULL, now_params = NULL;
     struct sigaction action_stop;
-- 
2.0.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]