[libvirt] [PATCH] qemu: Resolve Coverity UNINIT
John Ferlan
jferlan at redhat.com
Sun Aug 16 00:19:33 UTC 2015
On 08/15/2015 10:54 AM, Martin Kletzander wrote:
> On Sat, Aug 15, 2015 at 09:18:14AM -0400, John Ferlan wrote:
>> Coverity complained that 'vm' wasn't initialized before jumping to
>> cleanup: and calling virDomainObjEndAPI if the VIR_STRDUP fails.
>> Rather than initialize vm = NULL, I moved the VIR_STRDUP closer to
>> usage and used endjob for goto.
>>
>
> Wild pointers should not exist. At all. It's very subjective, but I
> just don't like them. ACK if you also initialize that pointer to
> NULL; that won't hurt anyone and will avoid possible future problems.
>
I agree in general - although in qemu_driver.c - it's hit or miss
whether 'vm' is initialized to NULL. I just flipped a coin and it landed
on moving the code instead of initializing the pointer ;-)
In any case added the = NULL; and pushed.
John
More information about the libvir-list
mailing list