]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix a couple of problems in last patch
authorDaniel Veillard <veillard@redhat.com>
Mon, 14 Dec 2009 10:05:55 +0000 (11:05 +0100)
committerDaniel Veillard <veillard@redhat.com>
Mon, 14 Dec 2009 10:05:55 +0000 (11:05 +0100)
Those were pointed by DanB in his review but not yet fixed

* src/qemu/qemu_driver.c: qemudWaitForMonitor() use EnterMonitorWithDriver()
  and ExitMonitorWithDriver() there
* src/qemu/qemu_monitor_text.c: checking fro strdu failure and hash
  table add error in qemuMonitorTextGetPtyPaths()

src/qemu/qemu_driver.c
src/qemu/qemu_monitor_text.c

index 7b8c4475b4eceb3b7f4037758ca836ef6b8eeebd..5a61b8ca8c180f44721f4881cb4798b4ef063391 100644 (file)
@@ -1534,10 +1534,10 @@ qemudWaitForMonitor(virConnectPtr conn,
         goto cleanup;
     }
 
-    qemuDomainObjEnterMonitor(vm);
+    qemuDomainObjEnterMonitorWithDriver(driver, vm);
     qemuDomainObjPrivatePtr priv = vm->privateData;
     ret = qemuMonitorGetPtyPaths(priv->mon, paths);
-    qemuDomainObjExitMonitor(vm);
+    qemuDomainObjExitMonitorWithDriver(driver, vm);
 
     VIR_DEBUG("qemuMonitorGetPtyPaths returned %i", ret);
     if (ret == 0) {
index 3ed45bafa4da116bb9cdf626acfd09a69571c476..0cb9ea6854acb79506a7bf72160061403348a880 100644 (file)
@@ -1650,9 +1650,19 @@ int qemuMonitorTextGetPtyPaths(qemuMonitorPtr mon,
 
         /* Path is everything after needle to the end of the line */
         *eol = '\0';
-        char *path = needle + strlen(NEEDLE);
+        char *path = strdup(needle + strlen(NEEDLE));
+        if (path == NULL) {
+            virReportOOMError(NULL);
+            goto cleanup;
+        }
 
-        virHashAddEntry(paths, id, strdup(path));
+        if (virHashAddEntry(paths, id, path) < 0) {
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
+                             _("failed to save chardev path '%s'"),
+                             path);
+            VIR_FREE(path);
+            goto cleanup;
+        }
 #undef NEEDLE
 
     next: