]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
More coverity findings addressed
authorStefan Berger <stefanb@linux.vnet.ibm.com>
Fri, 27 Apr 2012 21:25:35 +0000 (17:25 -0400)
committerStefan Berger <stefanb@us.ibm.com>
Fri, 27 Apr 2012 21:25:35 +0000 (17:25 -0400)
More bug extermination in the category of:

Error: CHECKED_RETURN:

/libvirt/src/conf/network_conf.c:595:
check_return: Calling function "virAsprintf" without checking return value (as is done elsewhere 515 out of 543 times).

/libvirt/src/qemu/qemu_process.c:2780:
unchecked_value: No check of the return value of "virAsprintf(&msg, "was paused (%s)", virDomainPausedReasonTypeToString(reason))".

/libvirt/tests/commandtest.c:809:
check_return: Calling function "setsid" without checking return value (as is done elsewhere 4 out of 5 times).

/libvirt/tests/commandtest.c:830:
unchecked_value: No check of the return value of "virTestGetDebug()".

/libvirt/tests/commandtest.c:831:
check_return: Calling function "virTestGetVerbose" without checking return value (as is done elsewhere 41 out of 42 times).

/libvirt/tests/commandtest.c:833:
check_return: Calling function "virInitialize" without checking return value (as is done elsewhere 18 out of 21 times).

One note about the error in commandtest line 809: setsid() seems to fail when running the test -- could be removed ?

src/conf/network_conf.c
src/qemu/qemu_process.c
tests/commandtest.c

index 17dc0d35390d6d02faafbfa61865b5e135fd4706..6515efefdfc9743a061632b65b7e25fbb4b222c6 100644 (file)
@@ -590,12 +590,9 @@ virNetworkDNSSrvDefParseXML(virNetworkDNSDefPtr def,
     }
 
     if (strlen(service) > DNS_RECORD_LENGTH_SRV) {
-        char *name = NULL;
-
-        virAsprintf(&name, _("Service name is too long, limit is %d bytes"), DNS_RECORD_LENGTH_SRV);
         virNetworkReportError(VIR_ERR_XML_DETAIL,
-                              "%s", name);
-        VIR_FREE(name);
+                              _("Service name is too long, limit is %d bytes"),
+                              DNS_RECORD_LENGTH_SRV);
         goto error;
     }
 
index 566a17e398194ca8dba5957897368e876bdba387..f1401e11f9b34b96007db164cca857445c321d5d 100644 (file)
@@ -2777,8 +2777,8 @@ qemuProcessUpdateState(struct qemud_driver *driver, virDomainObjPtr vm)
         } else {
             newState = VIR_DOMAIN_PAUSED;
             newReason = reason;
-            virAsprintf(&msg, "was paused (%s)",
-                        virDomainPausedReasonTypeToString(reason));
+            ignore_value(virAsprintf(&msg, "was paused (%s)",
+                                 virDomainPausedReasonTypeToString(reason)));
         }
     } else if (state == VIR_DOMAIN_SHUTOFF && running) {
         newState = VIR_DOMAIN_RUNNING;
index 28dc8750ce10f58c2c6a300c8a4f9b60b28cc37a..30e7efb605632ebf3a6979a465f22e5c80d5437b 100644 (file)
@@ -806,7 +806,7 @@ mymain(void)
         return EXIT_FAILURE;
 
     setpgid(0, 0);
-    setsid();
+    ignore_value(setsid());
 
     /* Our test expects particular fd values; to get that, we must not
      * leak fds that we inherited from a lazy parent.  At the same
@@ -827,10 +827,11 @@ mymain(void)
 
     /* Prime the debug/verbose settings from the env vars,
      * since we're about to reset 'environ' */
-    virTestGetDebug();
-    virTestGetVerbose();
+    ignore_value(virTestGetDebug());
+    ignore_value(virTestGetVerbose());
 
-    virInitialize();
+    if (virInitialize() < 0)
+        return EXIT_FAILURE;
 
     /* Phase two of killing interfering fds; see above.  */
     fd = 3;