Re: [libvirt] [PATCH] qemuInitPasswords: avoid unconditional leak

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

 



On Tue, Feb 16, 2010 at 09:24:01AM +0100, Jim Meyering wrote:
> A successful getVolumeQcowPassphrase allocates "secret".
> Nothing freed it.
> 
> >From 2aa6d3c4254f587133e473f4d193ccb023507665 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <meyering@xxxxxxxxxx>
> Date: Tue, 16 Feb 2010 09:22:02 +0100
> Subject: [PATCH] qemuInitPasswords: avoid unconditional leak
> 
> * src/qemu/qemu_driver.c (qemuInitPasswords): Free pass-phrase buffer.
> ---
>  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 03feaf4..e8b7cf6 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -1733,34 +1733,35 @@ qemuInitPasswords(virConnectPtr conn,
>          for (i = 0 ; i < vm->def->ndisks ; i++) {
>              char *secret;
>              size_t secretLen;
> 
>              if (!vm->def->disks[i]->encryption ||
>                  !vm->def->disks[i]->src)
>                  continue;
> 
>              if (getVolumeQcowPassphrase(conn,
>                                          vm->def->disks[i],
>                                          &secret, &secretLen) < 0)
>                  goto cleanup;

>              qemuDomainObjEnterMonitorWithDriver(driver, vm);
>              ret = qemuMonitorSetDrivePassphrase(priv->mon,
>                                                  vm->def->disks[i]->info.alias,
>                                                  secret);
> +            VIR_FREE(secret);
>              qemuDomainObjExitMonitorWithDriver(driver, vm);
>              if (ret < 0)
>                  goto cleanup;
>          }
>      }

  ACK,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]