]> xenbits.xensource.com Git - libvirt.git/commitdiff
examples: domtop: Fix uninitialized variable use
authorPeter Krempa <pkrempa@redhat.com>
Mon, 21 Jul 2014 07:52:02 +0000 (09:52 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Mon, 21 Jul 2014 13:20:59 +0000 (15:20 +0200)
max_id could be used uninitialized in the cleanup section after the
domain wasn't found.

Discovered by Coverity.

examples/domtop/domtop.c

index 8118793a067256177e8c9c2c79cd884fa7c23f8e..7661057b125d408d7e586bc799ab8989f29fca3b 100644 (file)
@@ -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;