提交 033369c7 编写于 作者: M Michal Privoznik

virPerfEventIsEnabled: Accept NULL @perf

After bdcf6e48 there is a crasher in libvirt. The commit assumes
that priv->perf is always set. That is not true. For inactive
domains, the priv->perf is not allocated as it is set in
qemuProcessLaunch(). Now, usually we differentiate between
accesses to inactive and active definition and it works just
fine. Except for 'domstats'. There priv->perf is accessed without
prior check for domain inactivity. While we could check for that,
more robust solution is to make virPerfEventIsEnabled() accept
NULL.

How to reproduce:
1) ensure you have at least one inactive domain
2) virsh domstats
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NDaniel P. Berrange <berrange@redhat.com>
上级 574718d3
......@@ -297,7 +297,7 @@ virPerfEventDisable(virPerfPtr perf,
bool virPerfEventIsEnabled(virPerfPtr perf,
virPerfEventType type)
{
return perf->events[type].enabled;
return perf && perf->events[type].enabled;
}
int
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册