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

Re: [libvirt] [PATCH] qemu_driver.c: avoid double free on error path



On Mon, Dec 14, 2009 at 03:59:33PM +0100, Jim Meyering wrote:
> Note that there's nearly identical code in the same file where
> there is already an "event = NULL;" statement right after
> two identical lines.
> 
> >From 69f3c74b6cdc36fb4958f4c9cc2d4497a03d40c1 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering redhat com>
> Date: Mon, 14 Dec 2009 15:55:19 +0100
> Subject: [PATCH] qemu_driver.c: avoid double free on error path
> 
> * src/qemu/qemu_driver.c (qemudDomainMigrateFinish2): Set
> "event" to NULL after qemuDomainEventQueue frees it, so a
> subsequent free (after endjob label) upon qemuMonitorStartCPUs
> failure does not cause a double free.
> ---
>  src/qemu/qemu_driver.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 34fa582..43f7927 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -7668,6 +7668,7 @@ qemudDomainMigrateFinish2 (virConnectPtr dconn,
>                                               VIR_DOMAIN_EVENT_DEFINED_UPDATED);
>              if (event)
>                  qemuDomainEventQueue(driver, event);
> +            event = NULL;
> 
>          }
>          qemuDomainObjPrivatePtr priv = vm->privateData;
> --
ACK

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


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