mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
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);
|
virObjectUnref(data->vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
mon = qemuMonitorTestGetMonitor(data->mon);
|
if (data->mon) {
|
||||||
virObjectLock(mon);
|
mon = qemuMonitorTestGetMonitor(data->mon);
|
||||||
qemuMonitorTestFree(data->mon);
|
virObjectLock(mon);
|
||||||
|
qemuMonitorTestFree(data->mon);
|
||||||
|
}
|
||||||
VIR_FREE(data);
|
VIR_FREE(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user