[Top][All Lists]

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

Re: Coverity CID 1421984

From: Philippe Mathieu-Daudé
Subject: Re: Coverity CID 1421984
Date: Mon, 23 Mar 2020 12:58:56 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0

Cc'ing qemu-ppc since this is restricted to the aCube Sam460ex board.

On 3/23/20 12:46 PM, Max Reitz wrote:

I was triaging new Coverity block layer reports today, and one that
seemed like a real bug was CID 1421984:

It complains about a memleak in sii3112_pci_realize() in
hw/ide/sii3112.c, specifically about @irq being leaked (it’s allocated
by qemu_allocate_irqs(), but never put anywhere or freed).

I’m not really well-versed in anything under hw/ide, so I was wondering
whether you agree it’s a bug and whether you know the correct way to fix
it.  (I assume it’s just a g_free(irqs), but maybe there’s a more
specific way that’s applicable here.)

What does other devices is hold a reference in the DeviceState (SiI3112PCIState) to make static analyzers happy.

Ideally we should free such memory in the DeviceUnrealize handler, but we in the reality we only care for hotunpluggable devices. PCI devices usually are. There is a trick however, you can mark overwrite the DeviceClass::hotpluggable field in sii3112_pci_class_init:

  dc->hotpluggable = false;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]