]> xenbits.xensource.com Git - libvirt.git/commitdiff
networkBandwidthUpdate: Don't blindly dereference pointers
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 12 Aug 2015 08:25:48 +0000 (10:25 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 12 Aug 2015 08:57:36 +0000 (10:57 +0200)
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: Michal Privoznik <mprivozn@redhat.com>
src/network/bridge_driver.c

index 666078caa0349dc2202d4e9a2fad9a6770ca8df7..f57c4003d72d5ec18164a7046ee49cc4cc541640 100644 (file)
@@ -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,