diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c index da5ccf59bfefab512b7e89655eb53a8e50018fde..bab3052ea5e55752153c962f546ec38c3c7bba46 100644 --- a/src/lxc/lxc_cgroup.c +++ b/src/lxc/lxc_cgroup.c @@ -51,7 +51,7 @@ static int virLXCCgroupSetupCpuTune(virDomainDefPtr def, goto cleanup; ret = 0; -cleanup: + cleanup: return ret; } @@ -97,7 +97,7 @@ static int virLXCCgroupSetupCpusetTune(virDomainDefPtr def, } ret = 0; -cleanup: + cleanup: VIR_FREE(mask); return ret; } @@ -168,7 +168,7 @@ static int virLXCCgroupSetupMemTune(virDomainDefPtr def, goto cleanup; ret = 0; -cleanup: + cleanup: return ret; } @@ -263,7 +263,7 @@ static int virLXCCgroupGetMemStat(virCgroupPtr cgroup, } ret = 0; -cleanup: + cleanup: VIR_FREE(line); VIR_FREE(statFile); VIR_FORCE_FCLOSE(statfd); @@ -292,7 +292,7 @@ int virLXCCgroupGetMeminfo(virLXCMeminfoPtr meminfo) virLXCCgroupGetMemSwapUsage(cgroup, meminfo); ret = 0; -cleanup: + cleanup: virCgroupFree(&cgroup); return ret; } @@ -452,7 +452,7 @@ static int virLXCCgroupSetupDeviceACL(virDomainDefPtr def, VIR_DEBUG("Device whitelist complete"); ret = 0; -cleanup: + cleanup: return ret; } @@ -498,7 +498,7 @@ virCgroupPtr virLXCCgroupCreate(virDomainDefPtr def) } } -cleanup: + cleanup: return cgroup; } @@ -526,6 +526,6 @@ int virLXCCgroupSetup(virDomainDefPtr def, ret = 0; -cleanup: + cleanup: return ret; } diff --git a/src/lxc/lxc_conf.c b/src/lxc/lxc_conf.c index d4432cf0ad093377a8d01b9f16ec143145c56aec..fd0b6efa60a74bcfa278df8d569e65700389bc29 100644 --- a/src/lxc/lxc_conf.c +++ b/src/lxc/lxc_conf.c @@ -157,7 +157,7 @@ virCapsPtr virLXCDriverCapsInit(virLXCDriverPtr driver) return caps; -error: + error: virObjectUnref(caps); return NULL; } @@ -230,7 +230,7 @@ virLXCDriverConfigNew(void) goto error; return cfg; -error: + error: virObjectUnref(cfg); return NULL; } @@ -283,7 +283,7 @@ virLXCLoadDriverConfig(virLXCDriverConfigPtr cfg, virConfFree(conf); -done: + done: return 0; } diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index b6c788a9ef9c7981ce164e4710c6020762c223b7..fd8ab167f8945d33ba6f82e6f0aed84814fa98c0 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -373,7 +373,7 @@ static int lxcContainerSetupFDs(int *ttyfd, rc = 0; -cleanup: + cleanup: VIR_DEBUG("rc=%d", rc); return rc; } @@ -400,7 +400,7 @@ int lxcContainerSendContinue(int control) } rc = 0; -error_out: + error_out: return rc; } @@ -506,7 +506,7 @@ static int lxcContainerRenameAndEnableInterfaces(bool privNet, if (veths || privNet) rc = virNetDevSetOnline("lo", true); -error_out: + error_out: VIR_FREE(newname); return rc; } @@ -580,7 +580,7 @@ static int lxcContainerUnmountSubtree(const char *prefix, ret = 0; -cleanup: + cleanup: virStringFreeList(mounts); return ret; @@ -718,7 +718,7 @@ static int lxcContainerPivotRoot(virDomainFSDefPtr root) ret = 0; -err: + err: VIR_FREE(oldroot); VIR_FREE(newroot); @@ -805,7 +805,7 @@ static int lxcContainerSetReadOnly(void) } ret = 0; -cleanup: + cleanup: for (i = 0; i < nmounts; i++) VIR_FREE(mounts[i]); VIR_FREE(mounts); @@ -892,7 +892,7 @@ static int lxcContainerMountBasicFS(bool userns_enabled) rc = 0; -cleanup: + cleanup: VIR_DEBUG("rc=%d", rc); return rc; } @@ -961,7 +961,7 @@ static int lxcContainerMountFSDev(virDomainDefPtr def, ret = 0; -cleanup: + cleanup: VIR_FREE(path); return ret; } @@ -996,7 +996,7 @@ static int lxcContainerMountFSDevPTS(virDomainDefPtr def, } ret = 0; -cleanup: + cleanup: VIR_FREE(path); return ret; } @@ -1126,7 +1126,7 @@ static int lxcContainerMountFSBind(virDomainFSDefPtr fs, ret = 0; -cleanup: + cleanup: VIR_FREE(src); return ret; } @@ -1193,9 +1193,9 @@ lxcContainerMountDetectFilesystem(const char *src, char **type) if (VIR_STRDUP(*type, data) < 0) goto cleanup; -done: + done: ret = 0; -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); if (blkid) blkid_free_probe(blkid); @@ -1237,7 +1237,7 @@ static int lxcContainerMountFSBlockAuto(virDomainFSDefPtr fs, VIR_DEBUG("src=%s dst=%s srcprefix=%s", src, fs->dst, srcprefix); /* First time around we use /etc/filesystems */ -retry: + retry: if (virAsprintf(&fslist, "%s%s", srcprefix, tryProc ? "/proc/filesystems" : "/etc/filesystems") < 0) goto cleanup; @@ -1338,7 +1338,7 @@ retry: VIR_DEBUG("Done mounting filesystem ret=%d tryProc=%d", ret, tryProc); -cleanup: + cleanup: VIR_FREE(line); VIR_FREE(fslist); VIR_FORCE_FCLOSE(fp); @@ -1386,7 +1386,7 @@ static int lxcContainerMountFSBlockHelper(virDomainFSDefPtr fs, ret = lxcContainerMountFSBlockAuto(fs, fsflags, src, srcprefix, sec_mount_options); } -cleanup: + cleanup: VIR_FREE(format); return ret; } @@ -1408,7 +1408,7 @@ static int lxcContainerMountFSBlock(virDomainFSDefPtr fs, VIR_DEBUG("Done mounting filesystem ret=%d", ret); -cleanup: + cleanup: VIR_FREE(src); return ret; } @@ -1452,7 +1452,7 @@ static int lxcContainerMountFSTmpfs(virDomainFSDefPtr fs, ret = 0; -cleanup: + cleanup: VIR_FREE(data); return ret; } @@ -1540,7 +1540,7 @@ int lxcContainerSetupHostdevCapsMakePath(const char *dev) ret = 0; -cleanup: + cleanup: VIR_FREE(dir); return ret; } @@ -1594,7 +1594,7 @@ static int lxcContainerUnmountForSharedRoot(const char *stateDir, ret = 0; -cleanup: + cleanup: VIR_FREE(tmp); return ret; } @@ -1682,7 +1682,7 @@ static int lxcContainerSetupPivotRoot(virDomainDefPtr vmDef, ret = 0; -cleanup: + cleanup: VIR_FREE(stateDir); virCgroupFree(&cgroup); VIR_FREE(sec_mount_options); @@ -1894,7 +1894,7 @@ static int lxcContainerChild(void *data) goto cleanup; ret = 0; -cleanup: + cleanup: VIR_FREE(ttyPath); VIR_FORCE_CLOSE(ttyfd); VIR_FORCE_CLOSE(argv->monitor); diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 3425110b0dfc382efdfa0482f9698c6d6acc4a8e..800a306cfd5af6878147156e6c5748d38717d963 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -186,13 +186,13 @@ static virLXCControllerPtr virLXCControllerNew(const char *name) NULL)) < 0) goto error; -cleanup: + cleanup: VIR_FREE(configFile); virObjectUnref(caps); virObjectUnref(xmlopt); return ctrl; -error: + error: virLXCControllerFree(ctrl); ctrl = NULL; goto cleanup; @@ -584,7 +584,7 @@ static int virLXCControllerSetupLoopDevices(virLXCControllerPtr ctrl) VIR_DEBUG("Setup all loop devices"); ret = 0; -cleanup: + cleanup: return ret; } @@ -665,7 +665,7 @@ static int virLXCControllerGetNumadAdvice(virLXCControllerPtr ctrl, ret = 0; *mask = nodemask; -cleanup: + cleanup: VIR_FREE(nodeset); return ret; } @@ -696,7 +696,7 @@ static int virLXCControllerSetupResourceLimits(virLXCControllerPtr ctrl) goto cleanup; ret = 0; -cleanup: + cleanup: virBitmapFree(nodemask); return ret; } @@ -789,7 +789,7 @@ static int virLXCControllerSetupServer(virLXCControllerPtr ctrl) VIR_FREE(sockpath); return 0; -error: + error: VIR_FREE(sockpath); virObjectUnref(ctrl->server); ctrl->server = NULL; @@ -945,7 +945,7 @@ static void virLXCControllerConsoleUpdateWatch(virLXCControllerConsolePtr consol } console->contEpoll = 0; } -cleanup: + cleanup: return; } @@ -993,7 +993,7 @@ static void virLXCControllerConsoleEPoll(int watch, int fd, int events, void *op } } -cleanup: + cleanup: virMutexUnlock(&lock); } @@ -1078,7 +1078,7 @@ static void virLXCControllerConsoleIO(int watch, int fd, int events, void *opaqu virMutexUnlock(&lock); return; -error: + error: virEventRemoveHandle(console->contWatch); virEventRemoveHandle(console->hostWatch); console->contWatch = console->hostWatch = -1; @@ -1157,9 +1157,9 @@ static int virLXCControllerMain(virLXCControllerPtr ctrl) if (!err || err->code == VIR_ERR_OK) rc = wantReboot ? 1 : 0; -cleanup: + cleanup: virMutexDestroy(&lock); -cleanup2: + cleanup2: for (i = 0; i < ctrl->nconsoles; i++) virLXCControllerConsoleClose(&(ctrl->consoles[i])); @@ -1192,11 +1192,11 @@ virLXCControllerSetupUsernsMap(virDomainIdMapEntryPtr map, } ret = 0; -cleanup: + cleanup: virBufferFreeAndReset(&map_value); return ret; -no_memory: + no_memory: virReportOOMError(); goto cleanup; } @@ -1235,7 +1235,7 @@ static int virLXCControllerSetupUserns(virLXCControllerPtr ctrl) goto cleanup; ret = 0; -cleanup: + cleanup: VIR_FREE(uid_map); VIR_FREE(gid_map); return ret; @@ -1285,7 +1285,7 @@ static int virLXCControllerSetupDev(virLXCControllerPtr ctrl) goto cleanup; ret = 0; -cleanup: + cleanup: VIR_FREE(opts); VIR_FREE(mount_options); VIR_FREE(dev); @@ -1336,7 +1336,7 @@ static int virLXCControllerPopulateDevices(virLXCControllerPtr ctrl) } ret = 0; -cleanup: + cleanup: VIR_FREE(path); return ret; } @@ -1411,7 +1411,7 @@ virLXCControllerSetupHostdevSubsysUSB(virDomainDefPtr vmDef, ret = 0; -cleanup: + cleanup: VIR_FREE(src); VIR_FREE(dstfile); VIR_FREE(dstdir); @@ -1491,7 +1491,7 @@ virLXCControllerSetupHostdevCapsStorage(virDomainDefPtr vmDef, ret = 0; -cleanup: + cleanup: def->source.caps.u.storage.block = dev; VIR_FREE(dst); VIR_FREE(path); @@ -1570,7 +1570,7 @@ virLXCControllerSetupHostdevCapsMisc(virDomainDefPtr vmDef, ret = 0; -cleanup: + cleanup: def->source.caps.u.misc.chardev = dev; VIR_FREE(dst); VIR_FREE(path); @@ -1732,7 +1732,7 @@ static int virLXCControllerSetupDisk(virLXCControllerPtr ctrl, ret = 0; -cleanup: + cleanup: def->src.path = tmpsrc; VIR_FREE(dst); return ret; @@ -1878,7 +1878,7 @@ lxcCreateTty(virLXCControllerPtr ctrl, int *ttymaster, ret = 0; -cleanup: + cleanup: if (ret != 0) { VIR_FORCE_CLOSE(*ttymaster); VIR_FREE(*ttyName); @@ -1927,7 +1927,7 @@ virLXCControllerSetupPrivateNS(void) } ret = 0; -cleanup: + cleanup: return ret; } @@ -1985,7 +1985,7 @@ virLXCControllerSetupDevPTS(virLXCControllerPtr ctrl) ret = 0; -cleanup: + cleanup: VIR_FREE(opts); VIR_FREE(devpts); VIR_FREE(mount_options); @@ -2031,7 +2031,7 @@ virLXCControllerSetupConsoles(virLXCControllerPtr ctrl, } ret = 0; -cleanup: + cleanup: VIR_FREE(ttyHostPath); return ret; } @@ -2073,7 +2073,7 @@ virLXCControllerEventSend(virLXCControllerPtr ctrl, xdr_free(proc, data); return; -error: + error: virNetMessageFree(msg); xdr_free(proc, data); } @@ -2246,7 +2246,7 @@ virLXCControllerRun(virLXCControllerPtr ctrl) virLXCControllerEventSendExit(ctrl, rc); -cleanup: + cleanup: VIR_FORCE_CLOSE(control[0]); VIR_FORCE_CLOSE(control[1]); VIR_FORCE_CLOSE(containerhandshake[0]); @@ -2474,7 +2474,7 @@ int main(int argc, char *argv[]) rc = virLXCControllerRun(ctrl); -cleanup: + cleanup: if (rc < 0) { virErrorPtr err = virGetLastError(); if (err && err->message) diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 53591c2e9a82832da048f0c273f5e54e9ca66bf4..e1afb5c6446779e29c895f9eb916aa7fed589d68 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -262,7 +262,7 @@ static virDomainPtr lxcDomainLookupByID(virConnectPtr conn, if (dom) dom->id = vm->def->id; -cleanup: + cleanup: if (vm) virObjectUnlock(vm); return dom; @@ -292,7 +292,7 @@ static virDomainPtr lxcDomainLookupByUUID(virConnectPtr conn, if (dom) dom->id = vm->def->id; -cleanup: + cleanup: if (vm) virObjectUnlock(vm); return dom; @@ -319,7 +319,7 @@ static virDomainPtr lxcDomainLookupByName(virConnectPtr conn, if (dom) dom->id = vm->def->id; -cleanup: + cleanup: if (vm) virObjectUnlock(vm); return dom; @@ -339,7 +339,7 @@ static int lxcDomainIsActive(virDomainPtr dom) ret = virDomainObjIsActive(obj); -cleanup: + cleanup: if (obj) virObjectUnlock(obj); return ret; @@ -359,7 +359,7 @@ static int lxcDomainIsPersistent(virDomainPtr dom) ret = obj->persistent; -cleanup: + cleanup: if (obj) virObjectUnlock(obj); return ret; @@ -378,7 +378,7 @@ static int lxcDomainIsUpdated(virDomainPtr dom) ret = obj->updated; -cleanup: + cleanup: if (obj) virObjectUnlock(obj); return ret; @@ -499,7 +499,7 @@ static virDomainPtr lxcDomainDefineXML(virConnectPtr conn, const char *xml) if (dom) dom->id = vm->def->id; -cleanup: + cleanup: virDomainDefFree(def); virDomainDefFree(oldDef); if (vm) @@ -552,7 +552,7 @@ static int lxcDomainUndefineFlags(virDomainPtr dom, ret = 0; -cleanup: + cleanup: if (vm) virObjectUnlock(vm); if (event) @@ -608,7 +608,7 @@ static int lxcDomainGetInfo(virDomainPtr dom, info->nrVirtCpu = vm->def->vcpus; ret = 0; -cleanup: + cleanup: if (vm) virObjectUnlock(vm); return ret; @@ -634,7 +634,7 @@ lxcDomainGetState(virDomainPtr dom, *state = virDomainObjGetState(vm, reason); ret = 0; -cleanup: + cleanup: if (vm) virObjectUnlock(vm); return ret; @@ -654,7 +654,7 @@ static char *lxcDomainGetOSType(virDomainPtr dom) if (VIR_STRDUP(ret, vm->def->os.type) < 0) goto cleanup; -cleanup: + cleanup: if (vm) virObjectUnlock(vm); return ret; @@ -675,7 +675,7 @@ lxcDomainGetMaxMemory(virDomainPtr dom) ret = vm->def->mem.max_balloon; -cleanup: + cleanup: if (vm) virObjectUnlock(vm); return ret; @@ -701,7 +701,7 @@ static int lxcDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax) vm->def->mem.max_balloon = newmax; ret = 0; -cleanup: + cleanup: if (vm) virObjectUnlock(vm); return ret; @@ -741,7 +741,7 @@ static int lxcDomainSetMemory(virDomainPtr dom, unsigned long newmem) ret = 0; -cleanup: + cleanup: if (vm) virObjectUnlock(vm); return ret; @@ -871,7 +871,7 @@ lxcDomainSetMemoryParameters(virDomainPtr dom, goto cleanup; ret = 0; -cleanup: + cleanup: if (vm) virObjectUnlock(vm); virObjectUnref(caps); @@ -968,7 +968,7 @@ lxcDomainGetMemoryParameters(virDomainPtr dom, *nparams = LXC_NB_MEM_PARAM; ret = 0; -cleanup: + cleanup: if (vm) virObjectUnlock(vm); virObjectUnref(caps); @@ -993,7 +993,7 @@ static char *lxcDomainGetXMLDesc(virDomainPtr dom, vm->newDef ? vm->newDef : vm->def, flags); -cleanup: + cleanup: if (vm) virObjectUnlock(vm); return ret; @@ -1023,7 +1023,7 @@ static char *lxcConnectDomainXMLFromNative(virConnectPtr conn, xml = virDomainDefFormat(def, 0); -cleanup: + cleanup: virDomainDefFree(def); return xml; } @@ -1084,7 +1084,7 @@ static int lxcDomainCreateWithFiles(virDomainPtr dom, virDomainAuditStart(vm, "booted", false); } -cleanup: + cleanup: if (vm) virObjectUnlock(vm); if (event) @@ -1197,7 +1197,7 @@ lxcDomainCreateXMLWithFiles(virConnectPtr conn, if (dom) dom->id = vm->def->id; -cleanup: + cleanup: virDomainDefFree(def); if (vm) virObjectUnlock(vm); @@ -1273,7 +1273,7 @@ static int lxcDomainGetSecurityLabel(virDomainPtr dom, virSecurityLabelPtr secla ret = 0; -cleanup: + cleanup: if (vm) virObjectUnlock(vm); return ret; @@ -1317,7 +1317,7 @@ static int lxcNodeGetSecurityModel(virConnectPtr conn, goto cleanup; } -cleanup: + cleanup: virObjectUnref(caps); return ret; } @@ -1448,7 +1448,7 @@ lxcDomainDestroyFlags(virDomainPtr dom, vm = NULL; } -cleanup: + cleanup: if (vm) virObjectUnlock(vm); if (event) @@ -1500,7 +1500,7 @@ lxcSecurityInit(virLXCDriverConfigPtr cfg) return mgr; -error: + error: VIR_ERROR(_("Failed to initialize security drivers")); virObjectUnref(mgr); return NULL; @@ -1607,7 +1607,7 @@ static int lxcStateInitialize(bool privileged, virNWFilterRegisterCallbackDriver(&lxcCallbackDriver); return 0; -cleanup: + cleanup: virObjectUnref(caps); lxcStateCleanup(); return -1; @@ -1776,7 +1776,7 @@ static char *lxcDomainGetSchedulerType(virDomainPtr dom, ignore_value(VIR_STRDUP(ret, "posix")); -cleanup: + cleanup: if (vm) virObjectUnlock(vm); return ret; @@ -1821,7 +1821,7 @@ static int lxcSetVcpuBWLive(virCgroupPtr cgroup, unsigned long long period, return 0; -error: + error: if (period) { virErrorPtr saved = virSaveLastError(); virCgroupSetCpuCfsPeriod(cgroup, old_period); @@ -1951,7 +1951,7 @@ lxcDomainSetSchedulerParametersFlags(virDomainPtr dom, ret = 0; -cleanup: + cleanup: virDomainDefFree(vmdef); if (vm) virObjectUnlock(vm); @@ -2032,7 +2032,7 @@ lxcDomainGetSchedulerParametersFlags(virDomainPtr dom, if (rc != 0) goto cleanup; } -out: + out: if (virTypedParameterAssign(¶ms[0], VIR_DOMAIN_SCHEDULER_CPU_SHARES, VIR_TYPED_PARAM_ULLONG, shares) < 0) goto cleanup; @@ -2060,7 +2060,7 @@ out: ret = 0; -cleanup: + cleanup: if (vm) virObjectUnlock(vm); virObjectUnref(caps); @@ -2162,11 +2162,11 @@ lxcDomainParseBlkioDeviceStr(char *blkioDeviceStr, const char *type, return 0; -error: + error: virReportError(VIR_ERR_INVALID_ARG, _("unable to parse blkio device '%s' '%s'"), type, blkioDeviceStr); -cleanup: + cleanup: virBlkioDeviceArrayClear(result, ndevices); VIR_FREE(result); return -1; @@ -2300,7 +2300,7 @@ lxcDomainBlockStats(virDomainPtr dom, &stats->wr_bytes, &stats->rd_req, &stats->wr_req); -cleanup: + cleanup: if (vm) virObjectUnlock(vm); return ret; @@ -2426,7 +2426,7 @@ lxcDomainBlockStatsFlags(virDomainPtr dom, ret = 0; *nparams = tmp; -cleanup: + cleanup: if (vm) virObjectUnlock(vm); return ret; @@ -2633,7 +2633,7 @@ lxcDomainSetBlkioParameters(virDomainPtr dom, ret = -1; } -cleanup: + cleanup: if (vm) virObjectUnlock(vm); virObjectUnref(caps); @@ -3049,7 +3049,7 @@ lxcDomainGetBlkioParameters(virDomainPtr dom, *nparams = LXC_NB_BLKIO_PARAM; ret = 0; -cleanup: + cleanup: if (vm) virObjectUnlock(vm); virObjectUnref(caps); @@ -3094,7 +3094,7 @@ lxcDomainInterfaceStats(virDomainPtr dom, virReportError(VIR_ERR_INVALID_ARG, _("Invalid path, '%s' is not a known interface"), path); -cleanup: + cleanup: if (vm) virObjectUnlock(vm); return ret; @@ -3125,7 +3125,7 @@ static int lxcDomainGetAutostart(virDomainPtr dom, *autostart = vm->autostart; ret = 0; -cleanup: + cleanup: if (vm) virObjectUnlock(vm); return ret; @@ -3194,7 +3194,7 @@ static int lxcDomainSetAutostart(virDomainPtr dom, vm->autostart = autostart; ret = 0; -cleanup: + cleanup: VIR_FREE(configFile); VIR_FREE(autostartLink); if (vm) @@ -3275,7 +3275,7 @@ static int lxcFreezeContainer(virDomainObjPtr vm) VIR_FREE(state); } VIR_DEBUG("lxcFreezeContainer timeout"); -error: + error: /* * If timeout or an error on reading the state occurs, * activate the group again and return an error. @@ -3284,7 +3284,7 @@ error: virCgroupSetFreezerState(priv->cgroup, "THAWED"); ret = -1; -cleanup: + cleanup: VIR_FREE(state); return ret; } @@ -3326,7 +3326,7 @@ static int lxcDomainSuspend(virDomainPtr dom) goto cleanup; ret = 0; -cleanup: + cleanup: if (event) virObjectEventStateQueue(driver->domainEventState, event); if (vm) @@ -3376,7 +3376,7 @@ static int lxcDomainResume(virDomainPtr dom) goto cleanup; ret = 0; -cleanup: + cleanup: if (event) virObjectEventStateQueue(driver->domainEventState, event); if (vm) @@ -3443,7 +3443,7 @@ lxcDomainOpenConsole(virDomainPtr dom, goto cleanup; ret = 0; -cleanup: + cleanup: if (vm) virObjectUnlock(vm); return ret; @@ -3516,7 +3516,7 @@ lxcDomainSendProcessSignal(virDomainPtr dom, ret = 0; -cleanup: + cleanup: if (vm) virObjectUnlock(vm); return ret; @@ -3615,7 +3615,7 @@ lxcDomainShutdownFlags(virDomainPtr dom, ret = 0; -cleanup: + cleanup: if (vm) virObjectUnlock(vm); return ret; @@ -3692,7 +3692,7 @@ lxcDomainReboot(virDomainPtr dom, ret = 0; -cleanup: + cleanup: if (vm) virObjectUnlock(vm); return ret; @@ -3750,7 +3750,7 @@ lxcDomainAttachDeviceConfig(virDomainDefPtr vmdef, break; } -cleanup: + cleanup: return ret; } @@ -3793,7 +3793,7 @@ lxcDomainUpdateDeviceConfig(virDomainDefPtr vmdef, break; } -cleanup: + cleanup: return ret; } @@ -3858,7 +3858,7 @@ lxcDomainDetachDeviceConfig(virDomainDefPtr vmdef, break; } -cleanup: + cleanup: return ret; } @@ -4113,7 +4113,7 @@ lxcDomainAttachDeviceDiskLive(virLXCDriverPtr driver, ret = 0; -cleanup: + cleanup: if (src) virDomainAuditDisk(vm, NULL, src, "attach", ret == 0); VIR_FREE(file); @@ -4230,7 +4230,7 @@ lxcDomainAttachDeviceNetLive(virConnectPtr conn, ret = 0; -cleanup: + cleanup: if (!ret) { vm->def->nets[vm->def->nnets++] = net; } else if (veth) { @@ -4316,7 +4316,7 @@ lxcDomainAttachDeviceHostdevSubsysUSBLive(virLXCDriverPtr driver, ret = 0; -cleanup: + cleanup: virDomainAuditHostdev(vm, def, "attach", ret == 0); virUSBDeviceFree(usb); VIR_FREE(src); @@ -4390,7 +4390,7 @@ lxcDomainAttachDeviceHostdevStorageLive(virLXCDriverPtr driver, ret = 0; -cleanup: + cleanup: virDomainAuditHostdev(vm, def, "attach", ret == 0); return ret; } @@ -4462,7 +4462,7 @@ lxcDomainAttachDeviceHostdevMiscLive(virLXCDriverPtr driver, ret = 0; -cleanup: + cleanup: virDomainAuditHostdev(vm, def, "attach", ret == 0); return ret; } @@ -4632,7 +4632,7 @@ lxcDomainDetachDeviceDiskLive(virDomainObjPtr vm, ret = 0; -cleanup: + cleanup: VIR_FREE(dst); return ret; } @@ -4694,7 +4694,7 @@ lxcDomainDetachDeviceNetLive(virDomainObjPtr vm, virDomainNetGetActualBridgeName(detach), detach->ifname)); ret = 0; -cleanup: + cleanup: if (!ret) { networkReleaseActualDevice(vm->def, detach); virDomainNetRemove(vm->def, detachidx); @@ -4760,7 +4760,7 @@ lxcDomainDetachDeviceHostdevUSBLive(virLXCDriverPtr driver, ret = 0; -cleanup: + cleanup: virUSBDeviceFree(usb); VIR_FREE(dst); return ret; @@ -4811,7 +4811,7 @@ lxcDomainDetachDeviceHostdevStorageLive(virDomainObjPtr vm, ret = 0; -cleanup: + cleanup: return ret; } @@ -4860,7 +4860,7 @@ lxcDomainDetachDeviceHostdevMiscLive(virDomainObjPtr vm, ret = 0; -cleanup: + cleanup: return ret; } @@ -5070,7 +5070,7 @@ static int lxcDomainAttachDeviceFlags(virDomainPtr dom, } } -cleanup: + cleanup: virDomainDefFree(vmdef); if (dev != dev_copy) virDomainDeviceDefFree(dev_copy); @@ -5192,7 +5192,7 @@ static int lxcDomainUpdateDeviceFlags(virDomainPtr dom, } } -cleanup: + cleanup: virDomainDefFree(vmdef); if (dev != dev_copy) virDomainDeviceDefFree(dev_copy); @@ -5312,7 +5312,7 @@ static int lxcDomainDetachDeviceFlags(virDomainPtr dom, } } -cleanup: + cleanup: virDomainDefFree(vmdef); if (dev != dev_copy) virDomainDeviceDefFree(dev_copy); @@ -5369,7 +5369,7 @@ static int lxcDomainLxcOpenNamespace(virDomainPtr dom, goto cleanup; ret = nfds; -cleanup: + cleanup: if (vm) virObjectUnlock(vm); return ret; @@ -5465,7 +5465,7 @@ lxcDomainMemoryStats(virDomainPtr dom, ret++; } -cleanup: + cleanup: if (vm) virObjectUnlock(vm); return ret; @@ -5606,7 +5606,7 @@ lxcDomainSetMetadata(virDomainPtr dom, ret = virDomainObjSetMetadata(vm, type, metadata, key, uri, caps, driver->xmlopt, cfg->configDir, flags); -cleanup: + cleanup: virObjectUnlock(vm); virObjectUnref(caps); virObjectUnref(cfg); @@ -5636,7 +5636,7 @@ lxcDomainGetMetadata(virDomainPtr dom, ret = virDomainObjGetMetadata(vm, type, uri, caps, driver->xmlopt, flags); -cleanup: + cleanup: virObjectUnlock(vm); virObjectUnref(caps); return ret; @@ -5683,7 +5683,7 @@ lxcDomainGetCPUStats(virDomainPtr dom, else ret = virCgroupGetPercpuStats(priv->cgroup, params, nparams, start_cpu, ncpus); -cleanup: + cleanup: if (vm) virObjectUnlock(vm); return ret; diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c index 81706c88fbdfc8eef6d71a963f4eda74d281d8ed..ee1561cfc98f179bfad9caf23ea04a46655f2ff8 100644 --- a/src/lxc/lxc_fuse.c +++ b/src/lxc/lxc_fuse.c @@ -78,7 +78,7 @@ static int lxcProcGetattr(const char *path, struct stat *stbuf) } else res = -ENOENT; -cleanup: + cleanup: VIR_FREE(mempath); return res; } @@ -219,7 +219,7 @@ static int lxcProcReadMeminfo(char *hostpath, virDomainDefPtr def, res = copied; memcpy(buf, virBufferCurrentContent(new_meminfo), copied); -cleanup: + cleanup: VIR_FREE(line); virBufferFreeAndReset(new_meminfo); VIR_FORCE_FCLOSE(fd); @@ -322,14 +322,14 @@ int lxcSetupFuse(virLXCFusePtr *f, virDomainDefPtr def) } ret = 0; -cleanup: + cleanup: fuse_opt_free_args(&args); *f = fuse; return ret; -cleanup1: + cleanup1: VIR_FREE(fuse->mountpoint); virMutexDestroy(&fuse->lock); -cleanup2: + cleanup2: VIR_FREE(fuse); goto cleanup; } diff --git a/src/lxc/lxc_monitor.c b/src/lxc/lxc_monitor.c index e9447cee7abc753d22de78ab37264433b8582217..57f40987e4747226a078de173e1d14dbf7309d3d 100644 --- a/src/lxc/lxc_monitor.c +++ b/src/lxc/lxc_monitor.c @@ -183,11 +183,11 @@ virLXCMonitorPtr virLXCMonitorNew(virDomainObjPtr vm, virNetClientSetCloseCallback(mon->client, virLXCMonitorEOFNotify, mon, virLXCMonitorCloseFreeCallback); -cleanup: + cleanup: VIR_FREE(sockpath); return mon; -error: + error: virObjectUnref(mon); mon = NULL; goto cleanup; diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c index fa0e62eddb364d91cc028f37412ab3579edd4680..fad51db9e92ae07942f43e91b4e4bae727c12e27 100644 --- a/src/lxc/lxc_native.c +++ b/src/lxc/lxc_native.c @@ -130,7 +130,7 @@ static char ** lxcStringSplit(const char *string) virStringFreeList(parts); return result; -error: + error: VIR_FREE(tmp); virStringFreeList(parts); virStringFreeList(result); @@ -162,7 +162,7 @@ lxcParseFstabLine(char *fstabLine) return fstab; -error: + error: lxcFstabFree(fstab); virStringFreeList(parts); return NULL; @@ -187,7 +187,7 @@ lxcAddFSDef(virDomainDefPtr def, return 0; -error: + error: virDomainFSDefFree(fsDef); return -1; } @@ -236,7 +236,7 @@ lxcConvertSize(const char *size, unsigned long long *value) return 0; -error: + error: virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to convert size: '%s'"), size); @@ -384,7 +384,7 @@ lxcCreateNetDef(const char *type, return net; -error: + error: virDomainNetDefFree(net); return NULL; } @@ -462,7 +462,7 @@ lxcAddNetworkDefinition(virDomainDefPtr def, return 1; -error: + error: virDomainNetDefFree(net); virDomainHostdevDefFree(hostdev); return -1; @@ -594,7 +594,7 @@ lxcCreateConsoles(virDomainDefPtr def, virConfPtr properties) return 0; -error: + error: virDomainChrDefFree(console); return -1; } @@ -696,7 +696,7 @@ lxcSetCpuTune(virDomainDefPtr def, virConfPtr properties) return 0; -error: + error: virReportError(VIR_ERR_INTERNAL_ERROR, _("failed to parse integer: '%s'"), value->str); return -1; @@ -934,11 +934,11 @@ lxcParseConfigString(const char *config) goto cleanup; -error: + error: virDomainDefFree(vmdef); vmdef = NULL; -cleanup: + cleanup: virConfFree(properties); return vmdef; diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index 2f4121c59697c63035ae997264f23eab05ccf6f1..75158e6eb21b49ca7456744c00ebba4572492ca5 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -129,7 +129,7 @@ virLXCProcessReboot(virLXCDriverPtr driver, ret = 0; -cleanup: + cleanup: virObjectUnref(conn); return ret; } @@ -287,7 +287,7 @@ char *virLXCProcessSetupInterfaceBridged(virConnectPtr conn, ret = containerVeth; -cleanup: + cleanup: return ret; } @@ -343,7 +343,7 @@ char *virLXCProcessSetupInterfaceDirect(virConnectPtr conn, ret = res_ifname; -cleanup: + cleanup: virObjectUnref(cfg); return ret; } @@ -469,7 +469,7 @@ static int virLXCProcessSetupInterfaces(virConnectPtr conn, ret = 0; -cleanup: + cleanup: if (ret < 0) { for (i = 0; i < def->nnets; i++) { virDomainNetDefPtr iface = def->nets[i]; @@ -588,7 +588,7 @@ virLXCProcessGetNsInode(pid_t pid, *inode = sb.st_ino; ret = 0; -cleanup: + cleanup: VIR_FREE(path); return ret; } @@ -660,7 +660,7 @@ static virLXCMonitorPtr virLXCProcessConnectMonitor(virLXCDriverPtr driver, goto cleanup; } -cleanup: + cleanup: virObjectUnref(cfg); return monitor; } @@ -742,7 +742,7 @@ int virLXCProcessStop(virLXCDriverPtr driver, } } -cleanup: + cleanup: virLXCProcessCleanup(driver, vm, reason); return 0; @@ -829,7 +829,7 @@ virLXCProcessBuildControllerCmd(virLXCDriverPtr driver, virCommandPassFD(cmd, handshakefd, 0); return cmd; -cleanup: + cleanup: virCommandFree(cmd); virObjectUnref(cfg); return NULL; @@ -916,7 +916,7 @@ virLXCProcessReadLogOutputData(virDomainObjPtr vm, _("Timed out while reading log output: %s"), buf); -cleanup: + cleanup: return ret; } @@ -981,7 +981,7 @@ virLXCProcessEnsureRootFS(virDomainObjPtr vm) return 0; -error: + error: virDomainFSDefFree(root); return -1; } @@ -1348,7 +1348,7 @@ int virLXCProcessStart(virConnectPtr conn, rc = 0; -cleanup: + cleanup: if (rc != 0 && !err) err = virSaveLastError(); virCommandFree(cmd); @@ -1399,7 +1399,7 @@ cleanup: return rc; -error: + error: err = virSaveLastError(); virLXCProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED); goto cleanup; @@ -1527,11 +1527,11 @@ virLXCProcessReconnectDomain(virDomainObjPtr vm, } ret = 0; -cleanup: + cleanup: virObjectUnlock(vm); return ret; -error: + error: virLXCProcessStop(driver, vm, VIR_DOMAIN_SHUTOFF_FAILED); virDomainAuditStop(vm, "failed"); goto cleanup;