mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 23:07:44 +00:00
qemu: fix a segfault in qemuProcessWaitForMonitor
Commit b3f2b4ca5c
left buf unallocated in
the case of QMP capability probing being used, leading to a segfault in
strlen in the cleanup path.
This patch opens the log and allocates the buffer if QMP probing was
used, so we can display the helpful error message.
This commit is contained in:
parent
718af45895
commit
b7a443fcbb
@ -1709,6 +1709,15 @@ cleanup:
|
||||
if (pos != -1 && kill(vm->pid, 0) == -1 && errno == ESRCH) {
|
||||
/* VM is dead, any other error raised in the interim is probably
|
||||
* not as important as the qemu cmdline output */
|
||||
if (qemuCapsUsedQMP(caps)) {
|
||||
if ((logfd = qemuDomainOpenLog(driver, vm, pos)) < 0)
|
||||
return -1;
|
||||
|
||||
if (VIR_ALLOC_N(buf, buf_size) < 0) {
|
||||
virReportOOMError();
|
||||
goto closelog;
|
||||
}
|
||||
}
|
||||
qemuProcessReadLogFD(logfd, buf, buf_size, strlen(buf));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("process exited while connecting to monitor: %s"),
|
||||
|
Loading…
Reference in New Issue
Block a user