mirror of https://gitee.com/openkylin/libvirt.git
qemuhotplugtest: Free monitor iff successfully initialized
If initializing test monitor in testQemuHotplugCpuPrepare() fails, the control jumps to error label where testQemuHotplugCpuDataFree() is called. But since the data->mon is NULL due to aforementioned failure, qemuMonitorTestGetMonitor() dereferences a NULL pointer leading to a SIGSEGV. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
parent
d482cf6bef
commit
b150fbc4fe
|
@ -399,9 +399,11 @@ testQemuHotplugCpuDataFree(struct testQemuHotplugCpuData *data)
|
|||
virObjectUnref(data->vm);
|
||||
}
|
||||
|
||||
mon = qemuMonitorTestGetMonitor(data->mon);
|
||||
virObjectLock(mon);
|
||||
qemuMonitorTestFree(data->mon);
|
||||
if (data->mon) {
|
||||
mon = qemuMonitorTestGetMonitor(data->mon);
|
||||
virObjectLock(mon);
|
||||
qemuMonitorTestFree(data->mon);
|
||||
}
|
||||
VIR_FREE(data);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue