[libvirt] [PATCH 5/8] xen: Resolve Coverity FORWARD_NULL

John Ferlan jferlan at redhat.com
Tue May 5 11:34:30 UTC 2015


Coverity found that xenXMConfigCacheAddFile has an error path in which
no error message and a -1 was not returned which could have resulted in
a NULL dereference in a VIR_DEBUG statement and of course an erroneous
0 value returned!

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/xen/xm_internal.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index 64752df..59b1cd4 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -279,6 +279,9 @@ xenXMConfigCacheAddFile(virConnectPtr conn, const char *filename)
             virDomainDefFree(entry->def);
             VIR_FREE(entry->filename);
             VIR_FREE(entry);
+            virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                           _("xenXMConfigCacheRefresh: virHashAddEntry name"));
+            return -1;
         }
     }
     VIR_DEBUG("Added config %s %s", entry->def->name, filename);
-- 
2.1.0




More information about the libvir-list mailing list