[libvirt] [PATCH] blockjob: fix memleak that prevented block pivot

Laine Stump laine at laine.org
Fri Dec 21 12:40:14 UTC 2012


On 12/20/2012 07:16 PM, Eric Blake wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=888426
>
> The code for doing a block-copy was supposed to track the destination
> file in drive->mirror, but was set up to do all mallocs prior to
> starting the copy so that OOM wouldn't leave things partially started.
> However, the wrong variable was being written; later in the code we
> silently did 'disk->mirror = mirror' which was still NULL, and thus
> leaking memory and leaving libvirt to think that the mirror job was
> never started, which prevented a pivot operation after a copy.
>
> * src/qemu/qemu_driver.c (qemuDomainBlockCopy): Initialize correct
> variable.
> ---
>  src/qemu/qemu_driver.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 7d8dd21..184f852 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -13429,7 +13429,7 @@ qemuDomainBlockCopy(virDomainPtr dom, const char *path,
>      }
>      if (!format && disk->mirrorFormat > 0)
>          format = virStorageFileFormatTypeToString(disk->mirrorFormat);
> -    if (!(disk->mirror = strdup(dest))) {
> +    if (!(mirror = strdup(dest))) {
>          virReportOOMError();
>          goto endjob;
>      }

ACK.




More information about the libvir-list mailing list