* src/qemu/qemu_driver.c (doCoreDump): Guarantee fd is closed.
---
Spotted by hand, while working on virDomainSaveFlags.
src/qemu/qemu_driver.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 1356c54..f9d2de4 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2525,10 +2525,11 @@ cleanup:
return ret;
}
-static int doCoreDump(struct qemud_driver *driver,
- virDomainObjPtr vm,
- const char *path,
- enum qemud_save_formats compress)
+static int
+doCoreDump(struct qemud_driver *driver,
+ virDomainObjPtr vm,
+ const char *path,
+ enum qemud_save_formats compress)
{
int fd = -1;
int ret = -1;
@@ -2554,6 +2555,7 @@ static int doCoreDump(struct qemud_driver *driver,
ret = 0;
cleanup:
+ VIR_FORCE_CLOSE(fd);
if (ret != 0)
unlink(path);
return ret;
--
1.7.4.4