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

networkBandwidthUpdate: Don't blindly dereference pointers

It may happen that an interface don't have any bandwidth set and
a new one is to be set. In that case, @ifaceBand will be NULL.
This will cause troubles later in the code when deciding what to
do.
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 73ca6f98
......@@ -5048,8 +5048,8 @@ networkBandwidthUpdate(virDomainNetDefPtr iface,
/* Okay, there are three possible scenarios: */
if (ifaceBand->in && ifaceBand->in->floor &&
newBandwidth->in && newBandwidth->in->floor) {
if (ifaceBand && ifaceBand->in && ifaceBand->in->floor &&
newBandwidth && newBandwidth->in && newBandwidth->in->floor) {
/* Either we just need to update @floor .. */
if (virNetDevBandwidthUpdateRate(network->def->bridge,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册