[PATCH 6/6] conf: Fix build with picky GCC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



../../src/conf/domain_conf.c:4425:21: error: potential null pointer dereference [-Werror=null-dereference]
         switch (vcpu->hotpluggable) {
                 ~~~~^~~~~~~~~~~~~~
---
 src/conf/domain_conf.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ae3eb14..61f6dbb 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4422,6 +4422,10 @@ virDomainVcpuDefPostParse(virDomainDefPtr def)
     for (i = 0; i < maxvcpus; i++) {
         vcpu = virDomainDefGetVcpu(def, i);

+        /* impossible but some compilers don't like it */
+        if (!vcpu)
+            continue;
+
         switch (vcpu->hotpluggable) {
         case VIR_TRISTATE_BOOL_ABSENT:
             if (vcpu->online)
-- 
2.8.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]