mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 19:32:19 +00:00
qemu: avoid fd leak on core dump failure
* src/qemu/qemu_driver.c (doCoreDump): Guarantee fd is closed.
This commit is contained in:
parent
2ceb35e1cd
commit
f532bfa297
@ -2525,7 +2525,8 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int doCoreDump(struct qemud_driver *driver,
|
||||
static int
|
||||
doCoreDump(struct qemud_driver *driver,
|
||||
virDomainObjPtr vm,
|
||||
const char *path,
|
||||
enum qemud_save_formats compress)
|
||||
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user