[libvirt] [PATCH v2 3/7] virsh-domain-monitor: Resolve Coverity issues

John Ferlan jferlan at redhat.com
Thu Jul 11 15:16:25 UTC 2013


Recent changes uncovered a pair of NEGATIVE_RETURNS when processing the
'nnames' in 'vshDomainListCollect' in the for loop due to possible -1 value.
---
 tools/virsh-domain-monitor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index 7af765e..5fbd32c 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -1599,7 +1599,7 @@ finished:
     success = true;
 
 cleanup:
-    for (i = 0; i < nnames; i++)
+    for (i = 0; nnames != -1 && i < nnames; i++)
         VIR_FREE(names[i]);
 
     if (!success) {
-- 
1.8.1.4




More information about the libvir-list mailing list