提交 b150fbc4 编写于 作者: M Michal Privoznik

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: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NAndrea Bolognani <abologna@redhat.com>
上级 d482cf6b
......@@ -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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册