Don't leak vm->monitorpath on re-connect

* src/qemu_driver.c: vm->monitorpath is already initialized in the case
  of re-connect, so move the initialization for the normal startup case
  out of the common code
This commit is contained in:
Mark McLoughlin 2009-07-09 16:02:19 +01:00
parent 72978b9789
commit 8a52daa2d4
1 changed files with 6 additions and 6 deletions

View File

@ -862,11 +862,6 @@ static int qemudOpenMonitor(virConnectPtr conn,
if (ret != 0)
goto error;
if (!(vm->monitorpath = strdup(monitor))) {
virReportOOMError(conn);
goto error;
}
if ((vm->monitorWatch = virEventAddHandle(vm->monitor, 0,
qemudDispatchVMEvent,
driver, NULL)) < 0)
@ -967,7 +962,12 @@ qemudFindCharDevicePTYs(virConnectPtr conn,
}
/* Got them all, so now open the monitor console */
ret = qemudOpenMonitor(conn, driver, vm, monitor, 0);
if ((ret = qemudOpenMonitor(conn, driver, vm, monitor, 0)) != 0)
goto cleanup;
vm->monitorpath = monitor;
return 0;
cleanup:
VIR_FREE(monitor);