mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
util: check for NULL parameter in virFileWrapperFdCatchError
This reverts 8927c0e
qemu: fix a crash when save file can't be opened
and allows virFileWrapperFdCatchError to be called with NULL instead.
This commit is contained in:
parent
0361917619
commit
7794e02c56
@ -2908,8 +2908,7 @@ qemuDomainSaveMemory(struct qemud_driver *driver,
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FORCE_CLOSE(fd);
|
VIR_FORCE_CLOSE(fd);
|
||||||
if (wrapperFd)
|
virFileWrapperFdCatchError(wrapperFd);
|
||||||
virFileWrapperFdCatchError(wrapperFd);
|
|
||||||
virFileWrapperFdFree(wrapperFd);
|
virFileWrapperFdFree(wrapperFd);
|
||||||
VIR_FREE(xml);
|
VIR_FREE(xml);
|
||||||
|
|
||||||
@ -3365,8 +3364,7 @@ doCoreDump(struct qemud_driver *driver,
|
|||||||
cleanup:
|
cleanup:
|
||||||
VIR_FORCE_CLOSE(fd);
|
VIR_FORCE_CLOSE(fd);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
if (wrapperFd)
|
virFileWrapperFdCatchError(wrapperFd);
|
||||||
virFileWrapperFdCatchError(wrapperFd);
|
|
||||||
unlink(path);
|
unlink(path);
|
||||||
}
|
}
|
||||||
virFileWrapperFdFree(wrapperFd);
|
virFileWrapperFdFree(wrapperFd);
|
||||||
|
@ -369,7 +369,7 @@ virFileWrapperFdClose(virFileWrapperFdPtr wfd)
|
|||||||
void
|
void
|
||||||
virFileWrapperFdCatchError(virFileWrapperFdPtr wfd)
|
virFileWrapperFdCatchError(virFileWrapperFdPtr wfd)
|
||||||
{
|
{
|
||||||
if (wfd->err_msg)
|
if (wfd && wfd->err_msg)
|
||||||
VIR_WARN("iohelper reports: %s", wfd->err_msg);
|
VIR_WARN("iohelper reports: %s", wfd->err_msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user