]> xenbits.xensource.com Git - libvirt.git/commitdiff
virsh-domain-monitor: Resolve Coverity issues
authorJohn Ferlan <jferlan@redhat.com>
Thu, 11 Jul 2013 14:28:44 +0000 (10:28 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 11 Jul 2013 18:18:11 +0000 (14:18 -0400)
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

index 7af765e8ece336c8e8814b3bd45ace502b46da6d..5fbd32c16461bdc02db0ad88997fa6f84aa95130 100644 (file)
@@ -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) {