1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-22 14:50:27 +03:00

blockjob: fix memleak that prevented block pivot

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.
Problem introduced in commit 35c7701c6.

* src/qemu/qemu_driver.c (qemuDomainBlockCopy): Initialize correct
variable.
This commit is contained in:
Eric Blake 2012-12-20 17:13:50 -07:00
parent 4f5c564939
commit 08230dbd7d

View File

@ -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;
}