virCopyLastError simply overwrites destination, which may lead to leak
if there already was error. Therefore we need first to free destination.
---
src/qemu/qemu_migration.c | 1 +
src/qemu/qemu_monitor.c | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 3e4f4fe..56dd26b 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1586,6 +1586,7 @@ static void qemuMigrationIOFunc(void *arg)
return;
error:
+ virResetError(&data->err);
virCopyLastError(&data->err);
virResetLastError();
}
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 8573262..66a4e48 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -603,6 +603,7 @@ qemuMonitorIO(int watch, int fd, int events, void *opaque) {
if (!err)
qemuReportError(VIR_ERR_INTERNAL_ERROR,
_("Error while processing monitor IO"));
+ virResetError(&mon->lastError);
virCopyLastError(&mon->lastError);
virResetLastError();
}
--
1.7.5.rc3