]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: avoid uninitialized variable
authorEric Blake <eblake@redhat.com>
Wed, 29 Jun 2011 18:04:08 +0000 (12:04 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 30 Jun 2011 17:36:51 +0000 (11:36 -0600)
Detected by Coverity; neither vshCmddefHelp nor vshCmdOptParse
was initializing opts_required.

* tools/virsh.c (vshCmddefOptParse): Always initialize bitmaps.

tools/virsh.c

index f96ee040df4540d71cfec7858fc9cd3a78eddf95..9a189fddbf3c6e0b3a1621950c5cd5212750e550 100644 (file)
@@ -11915,12 +11915,15 @@ vshCmddefGetInfo(const vshCmdDef * cmd, const char *name)
 }
 
 static int
-vshCmddefOptParse(const vshCmdDef *cmd, uint32_topts_need_arg,
+vshCmddefOptParse(const vshCmdDef *cmd, uint32_t *opts_need_arg,
                   uint32_t *opts_required)
 {
     int i;
     bool optional = false;
 
+    *opts_need_arg = 0;
+    *opts_required = 0;
+
     if (!cmd->opts)
         return 0;