[libvirt] [PATCH] vbox: fix compilation error

Michal Privoznik mprivozn at redhat.com
Tue Jun 10 17:29:38 UTC 2014


On 10.06.2014 19:10, Roman Bogorodskiy wrote:
> clang complains about possibly uninitialized variable:
>
> vbox/vbox_snapshot_conf.c:1355:9: error: variable 'ret' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
>      if (!(xPathContext = xmlXPathNewContext(xml))) {
>          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> So init 'ret' with NULL.

Okay, I must admit clang has cool error reporting. But in fact, ret may 
be used uninitialized way before reaching this line - there are two 
places before where conditional jump is possible. But I guess compiler 
is not SA tool anyway, right?

Michal




More information about the libvir-list mailing list