[libvirt] [PATCH 6/6] conf: Check error from virXMLFormatElement call

John Ferlan posted 6 patches 7 years, 6 months ago
[libvirt] [PATCH 6/6] conf: Check error from virXMLFormatElement call
Posted by John Ferlan 7 years, 6 months ago
Commit id 1bd5a08d added a call to virXMLFormatElement without
also checking the return status.

Found by Coverity.

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

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ab93bb7b45..1157c7dd93 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -27522,7 +27522,8 @@ virDomainDefFormatInternal(virDomainDefPtr def,
                                           unit, short_size);
                     }
 
-                    virXMLFormatElement(buf, "smm", &attrBuf, &childBuf);
+                    if (virXMLFormatElement(buf, "smm", &attrBuf, &childBuf) < 0)
+                        goto error;
                 }
 
                 break;
-- 
2.14.4

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