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

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



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 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


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