[libvirt] [PATCH] qemu: Fix double free when live-attaching shmem
Pavel Hrdina
phrdina at redhat.com
Wed Nov 9 16:55:34 UTC 2016
On Wed, Nov 09, 2016 at 05:43:49PM +0100, Martin Kletzander wrote:
> Function qemuDomainAttachShmemDevice() steals the device data if the
> hotplug was successful, but the condition checked for unsuccessful
> execution otherwise.
>
> Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
> ---
> src/qemu/qemu_driver.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 38c841420e32..a82e58b29f29 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -7615,7 +7615,7 @@ qemuDomainAttachDeviceLive(virDomainObjPtr vm,
> case VIR_DOMAIN_DEVICE_SHMEM:
> ret = qemuDomainAttachShmemDevice(driver, vm,
> dev->data.shmem);
> - if (ret < 0) {
> + if (!ret) {
In this case I would probably use ret == 0. We are not consistent at all, for
example in this function there is more occurrences of !ret, but in case of *int*
I think it's better to check for specific value, not like in case of *pointer*
or *bool* where !ret makes more sense.
ACK
Pavel
> alias = dev->data.shmem->info.alias;
> dev->data.shmem = NULL;
> }
> --
> 2.10.2
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20161109/8578485d/attachment-0001.sig>
More information about the libvir-list
mailing list