[libvirt] [PATCH 1/4] Don't leak vm->monitorpath on re-connect

Daniel P. Berrange berrange at redhat.com
Thu Jul 9 21:40:22 UTC 2009


On Thu, Jul 09, 2009 at 08:09:43PM +0100, Mark McLoughlin wrote:
> * src/qemu_driver.c: vm->monitorpath is already initialized in the case
>   of re-connect, so move the initialization for the normal startup case
>   out of the common code
> ---
>  src/qemu_driver.c |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/src/qemu_driver.c b/src/qemu_driver.c
> index 95ea882..636ee9d 100644
> --- a/src/qemu_driver.c
> +++ b/src/qemu_driver.c
> @@ -862,11 +862,6 @@ static int qemudOpenMonitor(virConnectPtr conn,
>      if (ret != 0)
>           goto error;
>  
> -    if (!(vm->monitorpath = strdup(monitor))) {
> -        virReportOOMError(conn);
> -        goto error;
> -    }
> -
>      if ((vm->monitorWatch = virEventAddHandle(vm->monitor, 0,
>                                                qemudDispatchVMEvent,
>                                                driver, NULL)) < 0)
> @@ -967,7 +962,12 @@ qemudFindCharDevicePTYs(virConnectPtr conn,
>      }
>  
>      /* Got them all, so now open the monitor console */
> -    ret = qemudOpenMonitor(conn, driver, vm, monitor, 0);
> +    if ((ret = qemudOpenMonitor(conn, driver, vm, monitor, 0)) != 0)
> +        goto cleanup;
> +
> +    vm->monitorpath = monitor;
> +
> +    return 0;
>  
>  cleanup:
>      VIR_FREE(monitor);

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 :|




More information about the libvir-list mailing list