On Wed, Mar 30, 2011 at 12:34:39PM +0800, Wen Congyang wrote: > --- > src/qemu/qemu_driver.c | 28 +++++++++++++++++++--------- > 1 files changed, 19 insertions(+), 9 deletions(-) > > diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c > index f843dc8..d79d61b 100644 > --- a/src/qemu/qemu_driver.c > +++ b/src/qemu/qemu_driver.c > @@ -2403,19 +2403,22 @@ static void processWatchdogEvent(void *data, void *opaque) > wdEvent->vm->def->name, > (unsigned int)time(NULL)) < 0) { > virReportOOMError(); > - break; > + goto cleanup; > } > > qemuDriverLock(driver); > virDomainObjLock(wdEvent->vm); > > - if (qemuDomainObjBeginJobWithDriver(driver, wdEvent->vm) < 0) > - break; > + if (qemuDomainObjBeginJobWithDriver(driver, wdEvent->vm) < 0) { > + VIR_FREE(dumpfile); > + goto unlock; > + } > > if (!virDomainObjIsActive(wdEvent->vm)) { > qemuReportError(VIR_ERR_OPERATION_INVALID, > "%s", _("domain is not running")); > - break; > + VIR_FREE(dumpfile); > + goto endjob; > } > > ret = doCoreDump(driver, > @@ -2432,16 +2435,23 @@ static void processWatchdogEvent(void *data, void *opaque) > qemuReportError(VIR_ERR_OPERATION_FAILED, > "%s", _("Resuming after dump failed")); > > - if (qemuDomainObjEndJob(wdEvent->vm) > 0) > - virDomainObjUnlock(wdEvent->vm); > - > - qemuDriverUnlock(driver); > - > VIR_FREE(dumpfile); > } > break; > + default: > + goto cleanup; > } > > +endjob: > + if (qemuDomainObjEndJob(wdEvent->vm) == 0) > + wdEvent->vm = NULL; > + > +unlock: > + if (wdEvent->vm) > + virDomainObjUnlock(wdEvent->vm); > + qemuDriverUnlock(driver); > + > +cleanup: > VIR_FREE(wdEvent); > } > Looks good to me. -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list