"Daniel P. Berrange" <berrange@xxxxxxxxxx> wrote: > static int umlDomainShutdown(virDomainPtr dom) { >- struct uml_driver *driver = (struct uml_driver *)dom->conn->privateData; >- virDomainObjPtr vm = virDomainFindByID(&driver->domains, dom->id); >- char* info; >+ struct uml_driver *driver = dom->conn->privateData; >+ virDomainObjPtr vm; >+ char *info; >+ int ret = -1; > >+ vm = virDomainFindByID(&driver->domains, dom->id); > if (!vm) { > umlReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_DOMAIN, > _("no domain with matching id %d"), dom->id); >- return -1; >+ goto cleanup; > } > > #if 0 > if (umlMonitorCommand(driver, vm, "system_powerdown", &info) < 0) { > umlReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, > "%s", _("shutdown operation failed")); >- return -1; >+ goto cleanup; > } >+ ret = 0; > #endif >+ >+cleanup: > VIR_FREE(info); >- return 0; >+ return ret; > > } info should be initialised to NULL, otherwise the VIR_FREE will fail. With the umlMonitorCommand if'ed out this is also broken before the patch, which is how I came to notice it. Ron -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list