When a VM fails to launch due to error creating nwfilter
rules, we must avoid overwriting the original error when
tearing down the partially created rules.
Signed-off-by: Daniel P. Berrange <berrange(a)redhat.com>
---
src/qemu/qemu_command.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 379c094..e34e537 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7654,8 +7654,12 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
ret = 0;
cleanup:
- if (ret < 0)
+ if (ret < 0) {
+ virErrorPtr saved_err = virSaveLastError();
virDomainConfNWFilterTeardown(net);
+ virSetError(saved_err);
+ virFreeError(saved_err);
+ }
for (i = 0; tapfd && i < tapfdSize && tapfd[i] >= 0; i++) {
if (ret < 0)
VIR_FORCE_CLOSE(tapfd[i]);
--
1.9.0