]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
vbox: Resolve Coverity UNUSED_VALUE
authorJohn Ferlan <jferlan@redhat.com>
Thu, 4 Sep 2014 13:56:06 +0000 (09:56 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 11 Sep 2014 11:33:19 +0000 (07:33 -0400)
Handle a few places where Coverity complains about the value being
unused. For two of them (Close cases) - the comments above the close
indicate there is no harm to ignore the error - so added an ignore_value.
For the other condition, added an rc check like other callers.

Signed-off-by: John Ferlan <jferlan@redhat.com>
src/vbox/vbox_common.c

index 684108d4b8aa0938533edfcb759dd0c01f6564b4..7ff0761f5e2a83d93e81f2a9cec2973267e11e99 100644 (file)
@@ -4345,6 +4345,11 @@ static int vboxCloseDisksRecursively(virDomainPtr dom, char *location)
             PRUnichar *childLocationUtf = NULL;
             char *childLocation = NULL;
             rc = gVBoxAPI.UIMedium.GetLocation(childMedium, &childLocationUtf);
+            if (NS_FAILED(rc)) {
+                virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                               _("Unable to get childMedium location"));
+                goto cleanup;
+            }
             VBOX_UTF16_TO_UTF8(childLocationUtf, &childLocation);
             VBOX_UTF16_FREE(childLocationUtf);
             if (vboxCloseDisksRecursively(dom, childLocation) < 0) {
@@ -4767,7 +4772,7 @@ vboxSnapshotRedefine(virDomainPtr dom,
                  * succeed, unless there is still another machine which uses the
                  * medium. No harm done if we ignore the error.
                  */
-                rc = gVBoxAPI.UIMedium.Close(medium);
+                ignore_value(gVBoxAPI.UIMedium.Close(medium));
             }
             VBOX_UTF8_FREE(locationUtf8);
         }
@@ -6987,7 +6992,7 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot)
              * reference in a sane order, which means that closing will normally
              * succeed, unless there is still another machine which uses the
              * medium. No harm done if we ignore the error. */
-            rc = gVBoxAPI.UIMedium.Close(medium);
+            ignore_value(gVBoxAPI.UIMedium.Close(medium));
         }
         VBOX_UTF16_FREE(locationUtf16);
         VBOX_UTF8_FREE(locationUtf8);