提交 1577e2d4 编写于 作者: J Ján Tomko

Indent top-level labels by one space in src/lxc/

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