mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
virPerfEventIsEnabled: Accept NULL @perf
After bdcf6e481 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: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
574718d366
commit
033369c7d9
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user