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>
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);
}