Commit id '73eda710' added virDomainKeyWrapDefParseXML which uses
virXPathNodeSet, but does not handle a -1 return thus causing a possible
loop condition exit problem later when the return value is used.

Change the logic to return the value from virXPathNodeSet if <= 0

Signed-off-by: John Ferlan <jfer...@redhat.com>
---
 src/conf/domain_conf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e2b1194..a97e640 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -940,8 +940,8 @@ virDomainKeyWrapDefParseXML(virDomainDefPtr def, 
xmlXPathContextPtr ctxt)
     xmlNodePtr *nodes = NULL;
     int n;
 
-    if (!(n = virXPathNodeSet("./keywrap/cipher", ctxt, &nodes)))
-        return 0;
+    if ((n = virXPathNodeSet("./keywrap/cipher", ctxt, &nodes)) < 0)
+        return n;
 
     if (VIR_ALLOC(def->keywrap) < 0)
         goto cleanup;
-- 
2.1.0

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

Reply via email to