--- src/util/iohelper.c | 6 ++-- src/util/virauth.c | 6 ++-- src/util/virauthconfig.c | 6 ++-- src/util/virbitmap.c | 2 +- src/util/vircgroup.c | 62 ++++++++++++++++++------------------- src/util/virclosecallbacks.c | 4 +-- src/util/vircommand.c | 6 ++-- src/util/virconf.c | 2 +- src/util/virdbus.c | 6 ++-- src/util/virdnsmasq.c | 8 ++--- src/util/virerror.c | 2 +- src/util/vireventpoll.c | 4 +-- src/util/virfile.c | 36 +++++++++++----------- src/util/virhostdev.c | 38 +++++++++++------------ src/util/viridentity.c | 8 ++--- src/util/virinitctl.c | 2 +- src/util/viriptables.c | 4 +-- src/util/viriscsi.c | 12 ++++---- src/util/virjson.c | 4 +-- src/util/virkeyfile.c | 8 ++--- src/util/virkmod.c | 6 ++-- src/util/virlockspace.c | 20 ++++++------ src/util/virlog.c | 12 ++++---- src/util/virnetdev.c | 50 +++++++++++++++--------------- src/util/virnetdevbandwidth.c | 10 +++--- src/util/virnetdevbridge.c | 26 ++++++++-------- src/util/virnetdevmacvlan.c | 22 +++++++------- src/util/virnetdevopenvswitch.c | 8 ++--- src/util/virnetdevtap.c | 10 +++--- src/util/virnetdevveth.c | 4 +-- src/util/virnetdevvportprofile.c | 16 +++++----- src/util/virnetlink.c | 12 ++++---- src/util/virnodesuspend.c | 8 ++--- src/util/virnuma.c | 4 +-- src/util/virobject.c | 2 +- src/util/virpci.c | 66 ++++++++++++++++++++-------------------- src/util/virpidfile.c | 16 +++++----- src/util/virportallocator.c | 6 ++-- src/util/virprocess.c | 16 +++++----- src/util/virscsi.c | 8 ++--- src/util/virsexpr.c | 4 +-- src/util/virsocketaddr.c | 4 +-- src/util/virstoragefile.c | 26 ++++++++-------- src/util/virstring.c | 4 +-- src/util/virsysinfo.c | 16 +++++----- src/util/virsystemd.c | 6 ++-- src/util/virthread.c | 2 +- src/util/virthreadpool.c | 6 ++-- src/util/virtpm.c | 2 +- src/util/virtypedparam.c | 24 +++++++-------- src/util/viruri.c | 6 ++-- src/util/virusb.c | 4 +-- src/util/virutil.c | 30 +++++++++--------- src/util/virxml.c | 8 ++--- 54 files changed, 345 insertions(+), 345 deletions(-) diff --git a/src/util/iohelper.c b/src/util/iohelper.c index 9610063..8a3c377 100644 --- a/src/util/iohelper.c +++ b/src/util/iohelper.c @@ -69,7 +69,7 @@ prepare(const char *path, int oflags, int mode, } } -cleanup: + cleanup: return fd; } @@ -189,7 +189,7 @@ runIO(const char *path, int fd, int oflags, unsigned long long length) ret = 0; -cleanup: + cleanup: if (VIR_CLOSE(fd) < 0 && ret == 0) { virReportSystemError(errno, _("Unable to close %s"), path); @@ -309,7 +309,7 @@ main(int argc, char **argv) return 0; -error: + error: err = virGetLastError(); if (err) { fprintf(stderr, "%s: %s\n", program_name, err->message); diff --git a/src/util/virauth.c b/src/util/virauth.c index 7f94eb6..f82e546 100644 --- a/src/util/virauth.c +++ b/src/util/virauth.c @@ -91,11 +91,11 @@ virAuthGetConfigFilePathURI(virURIPtr uri, VIR_FREE(*path); -done: + done: ret = 0; VIR_DEBUG("Using auth file '%s'", NULLSTR(*path)); -cleanup: + cleanup: VIR_FREE(userdir); return ret; @@ -141,7 +141,7 @@ virAuthGetCredential(const char *servicename, ret = 0; -cleanup: + cleanup: virAuthConfigFree(config); return ret; } diff --git a/src/util/virauthconfig.c b/src/util/virauthconfig.c index d7fd04a..6064e4a 100644 --- a/src/util/virauthconfig.c +++ b/src/util/virauthconfig.c @@ -57,7 +57,7 @@ virAuthConfigPtr virAuthConfigNew(const char *path) return auth; -error: + error: virAuthConfigFree(auth); return NULL; } @@ -83,7 +83,7 @@ virAuthConfigPtr virAuthConfigNewData(const char *path, return auth; -error: + error: virAuthConfigFree(auth); return NULL; } @@ -152,7 +152,7 @@ int virAuthConfigLookup(virAuthConfigPtr auth, ret = 0; -cleanup: + cleanup: VIR_FREE(authgroup); VIR_FREE(credgroup); return ret; diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c index 775262d..e44dce6 100644 --- a/src/util/virbitmap.c +++ b/src/util/virbitmap.c @@ -381,7 +381,7 @@ virBitmapParse(const char *str, return virBitmapCountBits(*bitmap); -error: + error: virReportError(VIR_ERR_INVALID_ARG, _("Failed to parse bitmap '%s'"), str); virBitmapFree(*bitmap); diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index a10d6f6..a0904d6 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -177,7 +177,7 @@ virCgroupPartitionNeedsEscaping(const char *path) goto cleanup; } -cleanup: + cleanup: VIR_FREE(line); VIR_FORCE_FCLOSE(fp); return ret; @@ -393,7 +393,7 @@ virCgroupDetectMounts(virCgroupPtr group) return 0; -error: + error: VIR_FORCE_FCLOSE(mounts); return -1; } @@ -546,7 +546,7 @@ virCgroupDetectPlacement(virCgroupPtr group, ret = 0; -cleanup: + cleanup: VIR_FREE(procfile); VIR_FORCE_FCLOSE(mapping); @@ -693,7 +693,7 @@ virCgroupSetValueStr(virCgroupPtr group, ret = 0; -cleanup: + cleanup: VIR_FREE(keypath); return ret; } @@ -727,7 +727,7 @@ virCgroupGetValueStr(virCgroupPtr group, ret = 0; -cleanup: + cleanup: VIR_FREE(keypath); return ret; } @@ -794,7 +794,7 @@ virCgroupGetValueI64(virCgroupPtr group, ret = 0; -cleanup: + cleanup: VIR_FREE(strval); return ret; } @@ -821,7 +821,7 @@ virCgroupGetValueU64(virCgroupPtr group, ret = 0; -cleanup: + cleanup: VIR_FREE(strval); return ret; } @@ -976,7 +976,7 @@ virCgroupMakeGroup(virCgroupPtr parent, VIR_DEBUG("Done making controllers for group"); ret = 0; -cleanup: + cleanup: return ret; } @@ -1027,7 +1027,7 @@ virCgroupNew(pid_t pid, return 0; -error: + error: virCgroupFree(group); *group = NULL; @@ -1063,7 +1063,7 @@ virCgroupAddTask(virCgroupPtr group, pid_t pid) } ret = 0; -cleanup: + cleanup: return ret; } @@ -1137,7 +1137,7 @@ virCgroupAddTaskStrController(virCgroupPtr group, } } -cleanup: + cleanup: VIR_FREE(str); return rc; } @@ -1186,7 +1186,7 @@ virCgroupMoveTask(virCgroupPtr src_group, virCgroupPtr dest_group) } ret = 0; -cleanup: + cleanup: VIR_FREE(content); return ret; } @@ -1232,7 +1232,7 @@ virCgroupSetPartitionSuffix(const char *path, char **res) ret = 0; -cleanup: + cleanup: virStringFreeList(tokens); return ret; } @@ -1294,7 +1294,7 @@ virCgroupNewPartition(const char *path, } ret = 0; -cleanup: + cleanup: if (ret != 0) virCgroupFree(group); virCgroupFree(&parent); @@ -1370,7 +1370,7 @@ virCgroupNewDomainPartition(virCgroupPtr partition, ret = 0; -cleanup: + cleanup: VIR_FREE(grpname); return ret; } @@ -1413,7 +1413,7 @@ virCgroupNewVcpu(virCgroupPtr domain, } ret = 0; -cleanup: + cleanup: VIR_FREE(name); return ret; } @@ -1450,7 +1450,7 @@ virCgroupNewEmulator(virCgroupPtr domain, } ret = 0; -cleanup: + cleanup: return ret; } @@ -1639,10 +1639,10 @@ virCgroupNewMachineManual(const char *name, } } -done: + done: ret = 0; -cleanup: + cleanup: virCgroupFree(&parent); return ret; } @@ -1898,7 +1898,7 @@ virCgroupGetBlkioIoServiced(virCgroupPtr group, ret = 0; -cleanup: + cleanup: VIR_FREE(str2); VIR_FREE(str1); return ret; @@ -2016,7 +2016,7 @@ virCgroupGetBlkioIoDeviceServiced(virCgroupPtr group, ret = 0; -cleanup: + cleanup: VIR_FREE(str3); VIR_FREE(str2); VIR_FREE(str1); @@ -2656,7 +2656,7 @@ virCgroupAllowDevice(virCgroupPtr group, char type, int major, int minor, ret = 0; -cleanup: + cleanup: VIR_FREE(devstr); return ret; } @@ -2693,7 +2693,7 @@ virCgroupAllowDeviceMajor(virCgroupPtr group, char type, int major, ret = 0; -cleanup: + cleanup: VIR_FREE(devstr); return ret; } @@ -2767,7 +2767,7 @@ virCgroupDenyDevice(virCgroupPtr group, char type, int major, int minor, ret = 0; -cleanup: + cleanup: VIR_FREE(devstr); return ret; } @@ -2804,7 +2804,7 @@ virCgroupDenyDeviceMajor(virCgroupPtr group, char type, int major, ret = 0; -cleanup: + cleanup: VIR_FREE(devstr); return ret; } @@ -2900,7 +2900,7 @@ virCgroupGetPercpuStats(virCgroupPtr group, rv = nparams; -cleanup: + cleanup: VIR_FREE(buf); return rv; } @@ -3225,7 +3225,7 @@ virCgroupKillInternal(virCgroupPtr group, int signum, virHashTablePtr pids) done: ret = killedAny ? 1 : 0; -cleanup: + cleanup: VIR_FREE(keypath); VIR_FORCE_FCLOSE(fp); @@ -3346,7 +3346,7 @@ virCgroupKillRecursiveInternal(virCgroupPtr group, done: ret = killedAny ? 1 : 0; -cleanup: + cleanup: virCgroupFree(&subgroup); closedir(dp); @@ -3501,7 +3501,7 @@ virCgroupGetCpuacctStat(virCgroupPtr group, unsigned long long *user, *sys *= scale; ret = 0; -cleanup: + cleanup: VIR_FREE(str); return ret; } @@ -3607,7 +3607,7 @@ virCgroupIsolateMount(virCgroupPtr group, const char *oldroot, } ret = 0; -cleanup: + cleanup: VIR_FREE(root); VIR_FREE(opts); return ret; @@ -3708,7 +3708,7 @@ virCgroupSupportsCpuBW(virCgroupPtr cgroup) ret = virFileExists(path); -cleanup: + cleanup: VIR_FREE(path); return ret; } diff --git a/src/util/virclosecallbacks.c b/src/util/virclosecallbacks.c index ff971c8..d62fd89 100644 --- a/src/util/virclosecallbacks.c +++ b/src/util/virclosecallbacks.c @@ -148,7 +148,7 @@ virCloseCallbacksSet(virCloseCallbacksPtr closeCallbacks, } ret = 0; -cleanup: + cleanup: virObjectUnlock(closeCallbacks); return ret; } @@ -180,7 +180,7 @@ virCloseCallbacksUnset(virCloseCallbacksPtr closeCallbacks, } ret = virHashRemoveEntry(closeCallbacks->list, uuidstr); -cleanup: + cleanup: virObjectUnlock(closeCallbacks); return ret; } diff --git a/src/util/vircommand.c b/src/util/vircommand.c index 8250634..510707c 100644 --- a/src/util/vircommand.c +++ b/src/util/vircommand.c @@ -1993,7 +1993,7 @@ virCommandProcessIO(virCommandPtr cmd) } ret = 0; -cleanup: + cleanup: if (cmd->outbuf && *cmd->outbuf) (*cmd->outbuf)[outlen] = '\0'; if (cmd->errbuf && *cmd->errbuf) @@ -2333,7 +2333,7 @@ virCommandRunAsync(virCommandPtr cmd, pid_t *pid) } } -cleanup: + cleanup: if (ret < 0) { VIR_FORCE_CLOSE(cmd->infd); VIR_FORCE_CLOSE(cmd->inpipe); @@ -2872,7 +2872,7 @@ virCommandRunRegex(virCommandPtr cmd, } ret = 0; -cleanup: + cleanup: virStringFreeList(lines); VIR_FREE(outbuf); if (groups) { diff --git a/src/util/virconf.c b/src/util/virconf.c index 233ad40..55de0e9 100644 --- a/src/util/virconf.c +++ b/src/util/virconf.c @@ -730,7 +730,7 @@ virConfParse(const char *filename, const char *content, int len, return ctxt.conf; -error: + error: virConfFree(ctxt.conf); return NULL; } diff --git a/src/util/virdbus.c b/src/util/virdbus.c index cacd604..0cd3858 100644 --- a/src/util/virdbus.c +++ b/src/util/virdbus.c @@ -755,7 +755,7 @@ virDBusMessageIterEncode(DBusMessageIter *rootiter, ret = 0; -cleanup: + cleanup: while (nstack > 0) { DBusMessageIter *thisiter = iter; VIR_DEBUG("Popping iter=%p", iter); @@ -1067,7 +1067,7 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter, ret = 0; -cleanup: + cleanup: virDBusTypeStackFree(&stack, &nstack); VIR_FREE(contsig); VIR_FREE(newiter); @@ -1113,7 +1113,7 @@ int virDBusMessageDecodeArgs(DBusMessage* msg, ret = virDBusMessageIterDecode(&iter, types, args); -cleanup: + cleanup: return ret; } diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c index 20dca0f..5991fe7 100644 --- a/src/util/virdnsmasq.c +++ b/src/util/virdnsmasq.c @@ -685,7 +685,7 @@ dnsmasqCapsSetFromBuffer(dnsmasqCapsPtr caps, const char *buf) dnsmasqCapsGet(caps, DNSMASQ_CAPS_BIND_DYNAMIC) ? "" : "NOT "); return 0; -fail: + fail: p = strchrnul(buf, '\n'); virReportError(VIR_ERR_INTERNAL_ERROR, _("cannot parse %s version number in '%.*s'"), @@ -705,7 +705,7 @@ dnsmasqCapsSetFromFile(dnsmasqCapsPtr caps, const char *path) ret = dnsmasqCapsSetFromBuffer(caps, buf); -cleanup: + cleanup: VIR_FREE(buf); return ret; } @@ -767,7 +767,7 @@ dnsmasqCapsRefreshInternal(dnsmasqCapsPtr caps, bool force) ret = dnsmasqCapsSetFromBuffer(caps, complete); -cleanup: + cleanup: virCommandFree(cmd); VIR_FREE(help); VIR_FREE(version); @@ -790,7 +790,7 @@ dnsmasqCapsNewEmpty(const char *binaryPath) goto error; return caps; -error: + error: virObjectUnref(caps); return NULL; } diff --git a/src/util/virerror.c b/src/util/virerror.c index 9db2452..cbbaa83 100644 --- a/src/util/virerror.c +++ b/src/util/virerror.c @@ -288,7 +288,7 @@ virSetError(virErrorPtr newerr) virResetError(err); ret = virCopyError(newerr, err); -cleanup: + cleanup: errno = saved_errno; return ret; } diff --git a/src/util/vireventpoll.c b/src/util/vireventpoll.c index d8a36e9..528b24c 100644 --- a/src/util/vireventpoll.c +++ b/src/util/vireventpoll.c @@ -668,9 +668,9 @@ int virEventPollRunOnce(void) VIR_FREE(fds); return 0; -error: + error: virMutexUnlock(&eventLoop.lock); -error_unlocked: + error_unlocked: VIR_FREE(fds); return -1; } diff --git a/src/util/virfile.c b/src/util/virfile.c index fefc3fb..6debbb0 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -267,7 +267,7 @@ virFileWrapperFdNew(int *fd, const char *name, unsigned int flags) *fd = pipefd[output]; return ret; -error: + error: VIR_FORCE_CLOSE(pipefd[0]); VIR_FORCE_CLOSE(pipefd[1]); virFileWrapperFdFree(ret); @@ -465,7 +465,7 @@ virFileRewrite(const char *path, ret = 0; -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); if (newfile) { unlink(newfile); @@ -643,7 +643,7 @@ static int virFileLoopDeviceOpenSearch(char **dev_name) virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unable to find a free loop device in /dev")); -cleanup: + cleanup: if (fd != -1) { VIR_DEBUG("Got free loop device %s %d", looppath, fd); *dev_name = looppath; @@ -719,7 +719,7 @@ int virFileLoopDeviceAssociate(const char *file, ret = 0; -cleanup: + cleanup: VIR_FREE(loname); VIR_FORCE_CLOSE(fsfd); if (ret == -1) @@ -752,7 +752,7 @@ virFileNBDDeviceIsBusy(const char *devname) } ret = 1; -cleanup: + cleanup: VIR_FREE(path); return ret; } @@ -794,7 +794,7 @@ virFileNBDDeviceFindUnused(void) virReportSystemError(EBUSY, "%s", _("No free NBD devices")); -cleanup: + cleanup: closedir(dh); return ret; } @@ -850,7 +850,7 @@ int virFileNBDDeviceAssociate(const char *file, nbddev = NULL; ret = 0; -cleanup: + cleanup: VIR_FREE(nbddev); VIR_FREE(qemunbd); virCommandFree(cmd); @@ -957,7 +957,7 @@ int virFileDeleteTree(const char *dir) ret = 0; -cleanup: + cleanup: VIR_FREE(filepath); closedir(dh); return ret; @@ -1137,7 +1137,7 @@ virFileFindMountPoint(const char *type) if (!ret) errno = ENOENT; -cleanup: + cleanup: endmntent(f); return ret; @@ -1644,7 +1644,7 @@ virFileGetMountSubtreeImpl(const char *mtabpath, *nmountsret = nmounts ? nmounts - 1 : 0; ret = 0; -cleanup: + cleanup: if (ret < 0) virStringFreeList(mounts); endmntent(procmnt); @@ -1776,7 +1776,7 @@ virFileAccessibleAs(const char *path, int mode, if (access(path, mode) < 0) ret = errno; -childerror: + childerror: if ((ret & 0xFF) != ret) { VIR_WARN("unable to pass desired return value %d", ret); ret = 0xFF; @@ -2064,7 +2064,7 @@ virFileOpenAs(const char *path, int openflags, mode_t mode, /* File is successfully opened */ return fd; -error: + error: if (fd >= 0) { /* some other failure after the open succeeded */ VIR_FORCE_CLOSE(fd); @@ -2110,7 +2110,7 @@ virDirCreateNoFork(const char *path, path, mode); goto error; } -error: + error: return ret; } @@ -2168,7 +2168,7 @@ virDirCreate(const char *path, * some cases */ return virDirCreateNoFork(path, mode, uid, gid, flags); } -parenterror: + parenterror: return ret; } @@ -2210,7 +2210,7 @@ parenterror: path, mode); goto childerror; } -childerror: + childerror: _exit(ret); } @@ -2322,7 +2322,7 @@ virFileMakePathWithMode(const char *path, ret = virFileMakePathHelper(tmp, mode); -cleanup: + cleanup: VIR_FREE(tmp); return ret; } @@ -2443,7 +2443,7 @@ virFileOpenTty(int *ttymaster, char **ttyName, int rawmode) ret = 0; -cleanup: + cleanup: if (ret != 0) VIR_FORCE_CLOSE(*ttymaster); VIR_FORCE_CLOSE(slave); @@ -2641,7 +2641,7 @@ int virFilePrintf(FILE *fp, const char *msg, ...) VIR_FREE(str); -cleanup: + cleanup: va_end(vargs); return ret; diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c index 5d5f72f..54023bd 100644 --- a/src/util/virhostdev.c +++ b/src/util/virhostdev.c @@ -119,7 +119,7 @@ virHostdevManagerNew(void) return hostdevMgr; -error: + error: virObjectUnref(hostdevMgr); return NULL; } @@ -288,7 +288,7 @@ virHostdevNetDevice(virDomainHostdevDefPtr hostdev, char **linkdev, ret = 0; -cleanup: + cleanup: VIR_FREE(sysfs_path); return ret; @@ -398,7 +398,7 @@ virHostdevNetConfigReplace(virDomainHostdevDefPtr hostdev, &hostdev->parent.data.net->mac, vlanid, stateDir); } -cleanup: + cleanup: VIR_FREE(linkdev); return ret; } @@ -629,7 +629,7 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr hostdev_mgr, ret = 0; goto cleanup; -inactivedevs: + inactivedevs: /* Only steal all the devices from activePCIHostdevs. We will * free them in virObjectUnref(). */ @@ -638,12 +638,12 @@ inactivedevs: virPCIDeviceListSteal(hostdev_mgr->activePCIHostdevs, dev); } -resetvfnetconfig: + resetvfnetconfig: for (i = 0; last_processed_hostdev_vf != -1 && i < last_processed_hostdev_vf; i++) virHostdevNetConfigRestore(hostdevs[i], hostdev_mgr->stateDir, NULL); -reattachdevs: + reattachdevs: for (i = 0; i < virPCIDeviceListCount(pcidevs); i++) { virPCIDevicePtr dev = virPCIDeviceListGet(pcidevs, i); @@ -654,7 +654,7 @@ reattachdevs: NULL)); } -cleanup: + cleanup: virObjectUnlock(hostdev_mgr->activePCIHostdevs); virObjectUnlock(hostdev_mgr->inactivePCIHostdevs); virObjectUnref(pcidevs); @@ -784,7 +784,7 @@ virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr, } virObjectUnref(pcidevs); -cleanup: + cleanup: virObjectUnlock(hostdev_mgr->activePCIHostdevs); virObjectUnlock(hostdev_mgr->inactivePCIHostdevs); } @@ -850,7 +850,7 @@ virHostdevUpdateActivePCIDevices(virHostdevManagerPtr mgr, } ret = 0; -cleanup: + cleanup: virPCIDeviceFree(dev); virObjectUnlock(mgr->activePCIHostdevs); virObjectUnlock(mgr->inactivePCIHostdevs); @@ -900,7 +900,7 @@ virHostdevUpdateActiveUSBDevices(virHostdevManagerPtr mgr, } } ret = 0; -cleanup: + cleanup: virObjectUnlock(mgr->activeUSBHostdevs); return ret; } @@ -954,7 +954,7 @@ virHostdevUpdateActiveSCSIDevices(virHostdevManagerPtr mgr, } ret = 0; -cleanup: + cleanup: virObjectUnlock(mgr->activeSCSIHostdevs); return ret; } @@ -1008,7 +1008,7 @@ virHostdevMarkUSBDevices(virHostdevManagerPtr mgr, virObjectUnlock(mgr->activeUSBHostdevs); return 0; -error: + error: for (j = 0; j < i; j++) { tmp = virUSBDeviceListGet(list, i); virUSBDeviceListSteal(mgr->activeUSBHostdevs, tmp); @@ -1099,7 +1099,7 @@ virHostdevFindUSBDevice(virDomainHostdevDefPtr hostdev, return -1; } -out: + out: if (!*usb) hostdev->missing = true; return 0; @@ -1174,7 +1174,7 @@ virHostdevPrepareUSBDevices(virHostdevManagerPtr hostdev_mgr, ret = 0; -cleanup: + cleanup: virObjectUnref(list); return ret; } @@ -1282,13 +1282,13 @@ virHostdevPrepareSCSIDevices(virHostdevManagerPtr hostdev_mgr, virObjectUnref(list); return 0; -error: + error: for (j = 0; j < i; j++) { tmp = virSCSIDeviceListGet(list, i); virSCSIDeviceListSteal(hostdev_mgr->activeSCSIHostdevs, tmp); } virObjectUnlock(hostdev_mgr->activeSCSIHostdevs); -cleanup: + cleanup: virObjectUnref(list); return -1; } @@ -1443,7 +1443,7 @@ virHostdevPCINodeDeviceDetach(virHostdevManagerPtr hostdev_mgr, } ret = 0; -out: + out: virObjectUnlock(hostdev_mgr->inactivePCIHostdevs); virObjectUnlock(hostdev_mgr->activePCIHostdevs); return ret; @@ -1484,7 +1484,7 @@ virHostdevPCINodeDeviceReAttach(virHostdevManagerPtr hostdev_mgr, goto out; ret = 0; -out: + out: virObjectUnlock(hostdev_mgr->inactivePCIHostdevs); virObjectUnlock(hostdev_mgr->activePCIHostdevs); return ret; @@ -1503,7 +1503,7 @@ virHostdevPCINodeDeviceReset(virHostdevManagerPtr hostdev_mgr, goto out; ret = 0; -out: + out: virObjectUnlock(hostdev_mgr->inactivePCIHostdevs); virObjectUnlock(hostdev_mgr->activePCIHostdevs); return ret; diff --git a/src/util/viridentity.c b/src/util/viridentity.c index 05e7568..a997385 100644 --- a/src/util/viridentity.c +++ b/src/util/viridentity.c @@ -217,7 +217,7 @@ virIdentityPtr virIdentityGetSystem(void) processtime) < 0) goto error; -cleanup: + cleanup: VIR_FREE(username); VIR_FREE(userid); VIR_FREE(groupname); @@ -227,7 +227,7 @@ cleanup: VIR_FREE(processtime); return ret; -error: + error: virObjectUnref(ret); ret = NULL; goto cleanup; @@ -295,7 +295,7 @@ int virIdentitySetAttr(virIdentityPtr ident, ret = 0; -cleanup: + cleanup: return ret; } @@ -349,6 +349,6 @@ bool virIdentityIsEqual(virIdentityPtr identA, } ret = true; -cleanup: + cleanup: return ret; } diff --git a/src/util/virinitctl.c b/src/util/virinitctl.c index 012200c..a6fda3b 100644 --- a/src/util/virinitctl.c +++ b/src/util/virinitctl.c @@ -154,7 +154,7 @@ virInitctlSetRunLevel(virInitctlRunLevel level) ret = 1; -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); return ret; } diff --git a/src/util/viriptables.c b/src/util/viriptables.c index d0dc081..c8c4175 100644 --- a/src/util/viriptables.c +++ b/src/util/viriptables.c @@ -858,7 +858,7 @@ iptablesForwardMasquerade(virSocketAddr *netaddr, } ret = virCommandRun(cmd, NULL); -cleanup: + cleanup: virCommandFree(cmd); VIR_FREE(networkstr); VIR_FREE(addrStartStr); @@ -952,7 +952,7 @@ iptablesForwardDontMasquerade(virSocketAddr *netaddr, virCommandAddArgList(cmd, "--source", networkstr, "--destination", destaddr, "--jump", "RETURN", NULL); ret = virCommandRun(cmd, NULL); -cleanup: + cleanup: virCommandFree(cmd); VIR_FREE(networkstr); return ret; diff --git a/src/util/viriscsi.c b/src/util/viriscsi.c index 18a595f..5e29be9 100644 --- a/src/util/viriscsi.c +++ b/src/util/viriscsi.c @@ -96,7 +96,7 @@ virISCSIGetSession(const char *devpath, goto cleanup; } -cleanup: + cleanup: virCommandFree(cmd); return cbdata.session; } @@ -184,7 +184,7 @@ virStorageBackendIQNFound(const char *initiatoriqn, if (virCommandWait(cmd, NULL) < 0) ret = IQN_ERROR; -out: + out: if (ret == IQN_MISSING) { VIR_DEBUG("Could not find interface with IQN '%s'", iqn); } @@ -262,7 +262,7 @@ virStorageBackendCreateIfaceIQN(const char *initiatoriqn, ret = 0; -cleanup: + cleanup: virCommandFree(cmd); VIR_FREE(temp_ifacename); if (ret != 0) @@ -314,7 +314,7 @@ virISCSIConnection(const char *portal, ret = 0; -cleanup: + cleanup: virCommandFree(cmd); VIR_FREE(ifacename); @@ -458,7 +458,7 @@ virISCSIScanTargets(const char *portal, } ret = 0; -cleanup: + cleanup: virCommandFree(cmd); return ret; } @@ -492,7 +492,7 @@ virISCSINodeUpdate(const char *portal, } ret = 0; -cleanup: + cleanup: virCommandFree(cmd); return ret; } diff --git a/src/util/virjson.c b/src/util/virjson.c index 5125ad0..35a8252 100644 --- a/src/util/virjson.c +++ b/src/util/virjson.c @@ -1008,7 +1008,7 @@ virJSONValuePtr virJSONValueFromString(const char *jsonstring) ret = parser.head; } -cleanup: + cleanup: yajl_free(hand); if (parser.nstate) { @@ -1128,7 +1128,7 @@ char *virJSONValueToString(virJSONValuePtr object, ignore_value(VIR_STRDUP(ret, (const char *)str)); -cleanup: + cleanup: yajl_gen_free(g); VIR_DEBUG("result=%s", NULLSTR(ret)); diff --git a/src/util/virkeyfile.c b/src/util/virkeyfile.c index acb77b9..742fb37 100644 --- a/src/util/virkeyfile.c +++ b/src/util/virkeyfile.c @@ -137,7 +137,7 @@ static int virKeyFileParseGroup(virKeyFileParserCtxtPtr ctxt) goto cleanup; ret = 0; -cleanup: + cleanup: if (ret != 0) { virHashFree(ctxt->group); ctxt->group = NULL; @@ -195,7 +195,7 @@ static int virKeyFileParseValue(virKeyFileParserCtxtPtr ctxt) ret = 0; -cleanup: + cleanup: VIR_FREE(key); return ret; } @@ -268,7 +268,7 @@ static int virKeyFileParse(virKeyFilePtr conf, } ret = 0; -cleanup: + cleanup: VIR_FREE(ctxt.groupname); return ret; } @@ -293,7 +293,7 @@ virKeyFilePtr virKeyFileNew(void) return conf; -error: + error: virKeyFileFree(conf); return NULL; } diff --git a/src/util/virkmod.c b/src/util/virkmod.c index 73cb3c7..e0bcdfc 100644 --- a/src/util/virkmod.c +++ b/src/util/virkmod.c @@ -46,7 +46,7 @@ doModprobe(const char *opts, const char *module, char **outbuf, char **errbuf) ret = 0; -cleanup: + cleanup: virCommandFree(cmd); return ret; } @@ -65,7 +65,7 @@ doRmmod(const char *module, char **errbuf) ret = 0; -cleanup: + cleanup: virCommandFree(cmd); return ret; } @@ -174,7 +174,7 @@ virKModIsBlacklisted(const char *module) if (strstr(outbuf, drvblklst)) retval = true; -cleanup: + cleanup: VIR_FREE(drvblklst); VIR_FREE(outbuf); return retval; diff --git a/src/util/virlockspace.c b/src/util/virlockspace.c index e41a4b0..8969ab0 100644 --- a/src/util/virlockspace.c +++ b/src/util/virlockspace.c @@ -226,7 +226,7 @@ virLockSpaceResourceNew(virLockSpacePtr lockspace, return res; -error: + error: virLockSpaceResourceFree(res); return NULL; } @@ -282,7 +282,7 @@ virLockSpacePtr virLockSpaceNew(const char *directory) return lockspace; -error: + error: virLockSpaceFree(lockspace); return NULL; } @@ -431,7 +431,7 @@ virLockSpacePtr virLockSpaceNewPostExecRestart(virJSONValuePtr object) return lockspace; -error: + error: virLockSpaceFree(lockspace); return NULL; } @@ -514,7 +514,7 @@ virJSONValuePtr virLockSpacePreExecRestart(virLockSpacePtr lockspace) virMutexUnlock(&lockspace->lock); return object; - error: + error: VIR_FREE(pairs); virJSONValueFree(object); virMutexUnlock(&lockspace->lock); @@ -565,7 +565,7 @@ int virLockSpaceCreateResource(virLockSpacePtr lockspace, ret = 0; -cleanup: + cleanup: virMutexUnlock(&lockspace->lock); VIR_FREE(respath); return ret; @@ -602,7 +602,7 @@ int virLockSpaceDeleteResource(virLockSpacePtr lockspace, ret = 0; -cleanup: + cleanup: virMutexUnlock(&lockspace->lock); VIR_FREE(respath); return ret; @@ -649,10 +649,10 @@ int virLockSpaceAcquireResource(virLockSpacePtr lockspace, goto cleanup; } -done: + done: ret = 0; -cleanup: + cleanup: virMutexUnlock(&lockspace->lock); return ret; } @@ -699,7 +699,7 @@ int virLockSpaceReleaseResource(virLockSpacePtr lockspace, ret = 0; -cleanup: + cleanup: virMutexUnlock(&lockspace->lock); return ret; } @@ -767,7 +767,7 @@ int virLockSpaceReleaseResourcesForOwner(virLockSpacePtr lockspace, virMutexUnlock(&lockspace->lock); return ret; -error: + error: virMutexUnlock(&lockspace->lock); return -1; } diff --git a/src/util/virlog.c b/src/util/virlog.c index 9ae30b6..d0afd10 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -321,7 +321,7 @@ virLogDefineFilter(const char *match, virLogFilters[i].flags = flags; virLogNbFilters++; virLogFiltersSerial++; -cleanup: + cleanup: virLogUnlock(); if (ret < 0) virReportOOMError(); @@ -409,7 +409,7 @@ virLogDefineOutput(virLogOutputFunc f, virLogOutputs[ret].priority = priority; virLogOutputs[ret].dest = dest; virLogOutputs[ret].name = ndup; -cleanup: + cleanup: virLogUnlock(); return ret; } @@ -633,7 +633,7 @@ virLogVMessage(virLogSourcePtr source, } virLogUnlock(); -cleanup: + cleanup: VIR_FREE(str); VIR_FREE(msg); errno = saved_errno; @@ -1005,7 +1005,7 @@ virLogOutputToJournald(virLogSourcePtr source, sendmsg(journalfd, &mh, MSG_NOSIGNAL); -cleanup: + cleanup: VIR_LOG_CLOSE(buffd); } @@ -1171,7 +1171,7 @@ virLogParseOutputs(const char *outputs) virSkipSpaces(&cur); } ret = count; -cleanup: + cleanup: if (ret == -1) VIR_WARN("Ignoring invalid log output setting."); return ret; @@ -1234,7 +1234,7 @@ virLogParseFilters(const char *filters) virSkipSpaces(&cur); } ret = count; -cleanup: + cleanup: if (ret == -1) VIR_WARN("Ignoring invalid log filter setting."); return ret; diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c index 6bcd73c..f26ea80 100644 --- a/src/util/virnetdev.c +++ b/src/util/virnetdev.c @@ -140,7 +140,7 @@ int virNetDevExists(const char *ifname) ret = 1; -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); return ret; } @@ -195,7 +195,7 @@ int virNetDevSetMAC(const char *ifname, ret = 0; -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); return ret; } @@ -228,7 +228,7 @@ int virNetDevSetMAC(const char *ifname, } ret = 0; -cleanup: + cleanup: VIR_FORCE_CLOSE(s); return ret; @@ -276,7 +276,7 @@ int virNetDevGetMAC(const char *ifname, ret = 0; -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); return ret; } @@ -402,7 +402,7 @@ int virNetDevGetMTU(const char *ifname) ret = ifr.ifr_mtu; -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); return ret; } @@ -448,7 +448,7 @@ int virNetDevSetMTU(const char *ifname, int mtu) ret = 0; -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); return ret; } @@ -552,7 +552,7 @@ int virNetDevSetName(const char* ifname, const char *newifname) ret = 0; -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); return ret; } @@ -612,7 +612,7 @@ int virNetDevSetOnline(const char *ifname, ret = 0; -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); return ret; } @@ -658,7 +658,7 @@ int virNetDevIsOnline(const char *ifname, *online = (ifr.ifr_flags & IFF_UP) ? true : false; ret = 0; -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); return ret; } @@ -719,7 +719,7 @@ int virNetDevGetIndex(const char *ifname, int *ifindex) # endif ret = 0; -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); return ret; } @@ -836,7 +836,7 @@ int virNetDevSetIPv4Address(const char *ifname, goto cleanup; ret = 0; -cleanup: + cleanup: VIR_FREE(addrstr); VIR_FREE(bcaststr); virCommandFree(cmd); @@ -882,7 +882,7 @@ virNetDevAddRoute(const char *ifname, goto cleanup; ret = 0; -cleanup: + cleanup: VIR_FREE(addrstr); VIR_FREE(gatewaystr); virCommandFree(cmd); @@ -930,7 +930,7 @@ int virNetDevClearIPv4Address(const char *ifname, goto cleanup; ret = 0; -cleanup: + cleanup: VIR_FREE(addrstr); virCommandFree(cmd); return ret; @@ -972,7 +972,7 @@ int virNetDevGetIPv4Address(const char *ifname, memcpy(&addr->data.inet4, &ifr.ifr_addr, addr->len); ret = 0; -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); return ret; } @@ -1151,7 +1151,7 @@ virNetDevGetVirtualFunctions(const char *pfname, ret = 0; -cleanup: + cleanup: if (ret < 0) { VIR_FREE(*vfname); VIR_FREE(*virt_fns); @@ -1278,7 +1278,7 @@ virNetDevGetVirtualFunctionInfo(const char *vfname, char **pfname, ret = virPCIGetVirtualFunctionIndex(pf_sysfs_path, vf_sysfs_path, vf); -cleanup: + cleanup: if (ret < 0) VIR_FREE(*pfname); @@ -1445,17 +1445,17 @@ virNetDevLinkDump(const char *ifname, int ifindex, goto malformed_resp; } rc = 0; -cleanup: + cleanup: nlmsg_free(nl_msg); VIR_FREE(resp); return rc; -malformed_resp: + malformed_resp: virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("malformed netlink response message")); goto cleanup; -buffer_too_small: + buffer_too_small: virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("allocated netlink buffer is too small")); goto cleanup; @@ -1567,17 +1567,17 @@ virNetDevSetVfConfig(const char *ifname, int ifindex, int vf, } rc = 0; -cleanup: + cleanup: nlmsg_free(nl_msg); VIR_FREE(resp); return rc; -malformed_resp: + malformed_resp: virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("malformed netlink response message")); goto cleanup; -buffer_too_small: + buffer_too_small: virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("allocated netlink buffer is too small")); goto cleanup; @@ -1634,7 +1634,7 @@ virNetDevParseVfConfig(struct nlattr **tb, int32_t vf, virMacAddrPtr mac, virReportError(VIR_ERR_INTERNAL_ERROR, _("couldn't find IFLA_VF_INFO for VF %d " "in netlink response"), vf); -cleanup: + cleanup: return rc; } @@ -1688,7 +1688,7 @@ virNetDevReplaceVfConfig(const char *pflinkdev, int vf, ret = virNetDevSetVfConfig(pflinkdev, ifindex, vf, true, macaddress, vlanid, NULL); -cleanup: + cleanup: VIR_FREE(path); VIR_FREE(fileData); return ret; @@ -1741,7 +1741,7 @@ virNetDevRestoreVfConfig(const char *pflinkdev, int vf, &oldmac, vlanid, NULL); ignore_value(unlink(path)); -cleanup: + cleanup: VIR_FREE(path); VIR_FREE(fileData); diff --git a/src/util/virnetdevbandwidth.c b/src/util/virnetdevbandwidth.c index ed6a19d..b06ed4c 100644 --- a/src/util/virnetdevbandwidth.c +++ b/src/util/virnetdevbandwidth.c @@ -233,7 +233,7 @@ virNetDevBandwidthSet(const char *ifname, ret = 0; -cleanup: + cleanup: virCommandFree(cmd); VIR_FREE(average); VIR_FREE(peak); @@ -316,7 +316,7 @@ virNetDevBandwidthCopy(virNetDevBandwidthPtr *dest, ret = 0; -cleanup: + cleanup: if (ret < 0) { virNetDevBandwidthFree(*dest); *dest = NULL; @@ -465,7 +465,7 @@ virNetDevBandwidthPlug(const char *brname, ret = 0; -cleanup: + cleanup: VIR_FREE(mac[1]); VIR_FREE(mac[0]); VIR_FREE(ceil); @@ -534,7 +534,7 @@ virNetDevBandwidthUnplug(const char *brname, ret = 0; -cleanup: + cleanup: VIR_FREE(filter_id); VIR_FREE(qdisc_id); VIR_FREE(class_id); @@ -582,7 +582,7 @@ virNetDevBandwidthUpdateRate(const char *ifname, ret = 0; -cleanup: + cleanup: virCommandFree(cmd); VIR_FREE(rate); VIR_FREE(ceil); diff --git a/src/util/virnetdevbridge.c b/src/util/virnetdevbridge.c index 1a3740a..d388358 100644 --- a/src/util/virnetdevbridge.c +++ b/src/util/virnetdevbridge.c @@ -103,7 +103,7 @@ static int virNetDevBridgeCmd(const char *brname, ret = ioctl(s, SIOCSDRVSPEC, &ifd); -cleanup: + cleanup: VIR_FORCE_CLOSE(s); return ret; @@ -159,7 +159,7 @@ static int virNetDevBridgeSet(const char *brname, } ret = 0; -cleanup: + cleanup: VIR_FREE(path); return ret; } @@ -213,7 +213,7 @@ static int virNetDevBridgeGet(const char *brname, } ret = 0; -cleanup: + cleanup: VIR_FREE(path); return ret; } @@ -245,7 +245,7 @@ int virNetDevBridgeCreate(const char *brname) ret = 0; -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); return ret; } @@ -270,7 +270,7 @@ int virNetDevBridgeCreate(const char *brname) } ret = 0; -cleanup: + cleanup: VIR_FORCE_CLOSE(s); return ret; } @@ -308,7 +308,7 @@ int virNetDevBridgeDelete(const char *brname) ret = 0; -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); return ret; } @@ -330,7 +330,7 @@ int virNetDevBridgeDelete(const char *brname) } ret = 0; -cleanup: + cleanup: VIR_FORCE_CLOSE(s); return ret; } @@ -376,7 +376,7 @@ int virNetDevBridgeAddPort(const char *brname, } ret = 0; -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); return ret; } @@ -446,7 +446,7 @@ int virNetDevBridgeRemovePort(const char *brname, } ret = 0; -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); return ret; } @@ -507,7 +507,7 @@ int virNetDevBridgeSetSTPDelay(const char *brname, ret = virNetDevBridgeSet(brname, "forward_delay", MS_TO_JIFFIES(delay), fd, &ifr); -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); return ret; } @@ -539,7 +539,7 @@ int virNetDevBridgeGetSTPDelay(const char *brname, fd, &ifr); *delayms = JIFFIES_TO_MS(val); -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); return ret; } @@ -568,7 +568,7 @@ int virNetDevBridgeSetSTP(const char *brname, ret = virNetDevBridgeSet(brname, "stp_state", enable ? 1 : 0, fd, &ifr); -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); return ret; } @@ -599,7 +599,7 @@ int virNetDevBridgeGetSTP(const char *brname, fd, &ifr); *enabled = val ? true : false; -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); return ret; } diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c index 1a1c1e2..42313b7 100644 --- a/src/util/virnetdevmacvlan.c +++ b/src/util/virnetdevmacvlan.c @@ -202,17 +202,17 @@ virNetDevMacVLanCreate(const char *ifname, } rc = 0; -cleanup: + cleanup: nlmsg_free(nl_msg); VIR_FREE(resp); return rc; -malformed_resp: + malformed_resp: virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("malformed netlink response message")); goto cleanup; -buffer_too_small: + buffer_too_small: virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("allocated netlink buffer is too small")); goto cleanup; @@ -279,17 +279,17 @@ int virNetDevMacVLanDelete(const char *ifname) } rc = 0; -cleanup: + cleanup: nlmsg_free(nl_msg); VIR_FREE(resp); return rc; -malformed_resp: + malformed_resp: virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("malformed netlink response message")); goto cleanup; -buffer_too_small: + buffer_too_small: virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("allocated netlink buffer is too small")); goto cleanup; @@ -786,7 +786,7 @@ virNetDevMacVLanVPortProfileRegisterCallback(const char *ifname, return 0; -error: + error: virNetlinkCallbackDataFree(calld); return -1; } @@ -871,7 +871,7 @@ int virNetDevMacVLanCreateWithVPortProfile(const char *tgifname, if (rc < 0) return -1; } else { -create_name: + create_name: retries = 5; if (virNetDevMacVLanCreateMutexInitialize() < 0) return -1; @@ -960,7 +960,7 @@ create_name: return rc; -disassociate_exit: + disassociate_exit: ignore_value(virNetDevVPortProfileDisassociate(cr_ifname, virtPortProfile, macaddress, @@ -968,7 +968,7 @@ disassociate_exit: vf, vmOp)); -link_del_exit: + link_del_exit: ignore_value(virNetDevMacVLanDelete(cr_ifname)); return rc; @@ -1053,7 +1053,7 @@ int virNetDevMacVLanRestartWithVPortProfile(const char *cr_ifname, vmuuid, vmOp, true)); -error: + error: return rc; } diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c index b4feb1e..d6a16c6 100644 --- a/src/util/virnetdevopenvswitch.c +++ b/src/util/virnetdevopenvswitch.c @@ -156,7 +156,7 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname, } ret = 0; -cleanup: + cleanup: virBufferFreeAndReset(&buf); VIR_FREE(attachedmac_ex_id); VIR_FREE(ifaceid_ex_id); @@ -189,7 +189,7 @@ int virNetDevOpenvswitchRemovePort(const char *brname ATTRIBUTE_UNUSED, const ch } ret = 0; -cleanup: + cleanup: virCommandFree(cmd); return ret; } @@ -224,7 +224,7 @@ int virNetDevOpenvswitchGetMigrateData(char **migrate, const char *ifname) /* Wipeout the newline */ (*migrate)[strlen(*migrate) - 1] = '\0'; ret = 0; -cleanup: + cleanup: virCommandFree(cmd); return ret; } @@ -256,7 +256,7 @@ int virNetDevOpenvswitchSetMigrateData(char *migrate, const char *ifname) } ret = 0; -cleanup: + cleanup: virCommandFree(cmd); return ret; } diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c index a36af76..32ad406 100644 --- a/src/util/virnetdevtap.c +++ b/src/util/virnetdevtap.c @@ -226,7 +226,7 @@ int virNetDevTapCreate(char **ifname, ret = 0; -cleanup: + cleanup: if (ret < 0) { VIR_FORCE_CLOSE(fd); while (i--) @@ -273,7 +273,7 @@ int virNetDevTapDelete(const char *ifname) ret = 0; -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); return ret; } @@ -359,7 +359,7 @@ int virNetDevTapCreate(char **ifname, ret = 0; -cleanup: + cleanup: VIR_FORCE_CLOSE(s); return ret; @@ -382,7 +382,7 @@ int virNetDevTapDelete(const char *ifname) } ret = 0; -cleanup: + cleanup: VIR_FORCE_CLOSE(s); return ret; } @@ -500,7 +500,7 @@ int virNetDevTapCreateInBridgePort(const char *brname, return 0; -error: + error: for (i = 0; i < tapfdSize && tapfd[i] >= 0; i++) VIR_FORCE_CLOSE(tapfd[i]); diff --git a/src/util/virnetdevveth.c b/src/util/virnetdevveth.c index 834bee3..14febb7 100644 --- a/src/util/virnetdevveth.c +++ b/src/util/virnetdevveth.c @@ -197,7 +197,7 @@ int virNetDevVethCreate(char** veth1, char** veth2) _("Failed to allocate free veth pair after %d attempts"), MAX_VETH_RETRIES); -cleanup: + cleanup: virMutexUnlock(&virNetDevVethCreateMutex); virCommandFree(cmd); VIR_FREE(veth1auto); @@ -237,7 +237,7 @@ int virNetDevVethDelete(const char *veth) } ret = 0; -cleanup: + cleanup: virCommandFree(cmd); return ret; } diff --git a/src/util/virnetdevvportprofile.c b/src/util/virnetdevvportprofile.c index d77c31f..8977275 100644 --- a/src/util/virnetdevvportprofile.c +++ b/src/util/virnetdevvportprofile.c @@ -434,7 +434,7 @@ int virNetDevVPortProfileMerge3(virNetDevVPortProfilePtr *result, ret = 0; -error: + error: if (ret < 0) VIR_FREE(*result); return ret; @@ -578,7 +578,7 @@ virNetDevVPortProfileGetStatus(struct nlattr **tb, int32_t vf, goto cleanup; } } -cleanup: + cleanup: return rc; } @@ -747,17 +747,17 @@ virNetDevVPortProfileOpSetLink(const char *ifname, int ifindex, } rc = 0; -cleanup: + cleanup: nlmsg_free(nl_msg); VIR_FREE(resp); return rc; -malformed_resp: + malformed_resp: virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("malformed netlink response message")); goto cleanup; -buffer_too_small: + buffer_too_small: virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("allocated netlink buffer is too small")); goto cleanup; @@ -907,7 +907,7 @@ virNetDevVPortProfileOpCommon(const char *ifname, int ifindex, rc = -2; } -cleanup: + cleanup: return rc; } @@ -1006,7 +1006,7 @@ virNetDevVPortProfileOp8021Qbg(const char *ifname, vf, op, setlink_only); -cleanup: + cleanup: return rc; } @@ -1109,7 +1109,7 @@ virNetDevVPortProfileOp8021Qbh(const char *ifname, rc = -1; } -cleanup: + cleanup: VIR_FREE(physfndev); return rc; } diff --git a/src/util/virnetlink.c b/src/util/virnetlink.c index b163ffb..0cf18f2 100644 --- a/src/util/virnetlink.c +++ b/src/util/virnetlink.c @@ -264,7 +264,7 @@ int virNetlinkCommand(struct nl_msg *nl_msg, "%s", _("nl_recv failed")); rc = -1; } -error: + error: if (rc == -1) { VIR_FREE(*resp); *resp = NULL; @@ -578,12 +578,12 @@ virNetlinkEventServiceStart(unsigned int protocol, unsigned int groups) ret = 0; server[protocol] = srv; -error_server: + error_server: if (ret < 0) { nl_close(srv->netlinknh); virNetlinkFree(srv->netlinknh); } -error_locked: + error_locked: virNetlinkEventServerUnlock(srv); if (ret < 0) { virMutexDestroy(&srv->lock); @@ -652,7 +652,7 @@ virNetlinkEventAddClient(virNetlinkEventHandleCallback handleCB, } r = srv->handlesCount++; -addentry: + addentry: srv->handles[r].watch = nextWatch; srv->handles[r].handleCB = handleCB; srv->handles[r].removeCB = removeCB; @@ -667,7 +667,7 @@ addentry: VIR_DEBUG("added client to loop slot: %d. with macaddr ptr=%p", r, macaddr); ret = nextWatch++; -error: + error: virNetlinkEventServerUnlock(srv); return ret; } @@ -724,7 +724,7 @@ virNetlinkEventRemoveClient(int watch, const virMacAddr *macaddr, } VIR_DEBUG("no client found to remove."); -cleanup: + cleanup: virNetlinkEventServerUnlock(srv); return ret; } diff --git a/src/util/virnodesuspend.c b/src/util/virnodesuspend.c index 6d2f50d..8088931 100644 --- a/src/util/virnodesuspend.c +++ b/src/util/virnodesuspend.c @@ -100,7 +100,7 @@ static int virNodeSuspendSetNodeWakeup(unsigned long long alarmTime) ret = 0; -cleanup: + cleanup: virCommandFree(setAlarmCmd); return ret; } @@ -240,7 +240,7 @@ int nodeSuspendForDuration(unsigned int target, aboutToSuspend = true; ret = 0; -cleanup: + cleanup: virNodeSuspendUnlock(); return ret; } @@ -296,7 +296,7 @@ virNodeSuspendSupportsTarget(unsigned int target, bool *supported) *supported = (status == 0); ret = 0; -cleanup: + cleanup: virCommandFree(cmd); return ret; } @@ -349,7 +349,7 @@ virNodeSuspendGetTargetMask(unsigned int *bitmask) *bitmask = nodeSuspendTargetMask; ret = 0; -cleanup: + cleanup: virNodeSuspendUnlock(); return ret; } diff --git a/src/util/virnuma.c b/src/util/virnuma.c index 6ed1cb9..bf3b9e6 100644 --- a/src/util/virnuma.c +++ b/src/util/virnuma.c @@ -176,7 +176,7 @@ virNumaSetupMemoryPolicy(virNumaTuneDef numatune, ret = 0; -cleanup: + cleanup: return ret; } @@ -320,7 +320,7 @@ virNumaGetNodeCPUs(int node, cpumap = NULL; ret = ncpus; -cleanup: + cleanup: VIR_FREE(mask); VIR_FREE(allonesmask); VIR_FREE(cpumap); diff --git a/src/util/virobject.c b/src/util/virobject.c index d1612be..c8bc193 100644 --- a/src/util/virobject.c +++ b/src/util/virobject.c @@ -147,7 +147,7 @@ virClassPtr virClassNew(virClassPtr parent, return klass; -error: + error: VIR_FREE(klass); return NULL; } diff --git a/src/util/virpci.c b/src/util/virpci.c index 0874456..af0bfa8 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -266,7 +266,7 @@ virPCIDeviceGetDriverPathAndName(virPCIDevicePtr dev, char **path, char **name) /* name = "${drivername}" */ ret = 0; -cleanup: + cleanup: VIR_FREE(drvlink); if (ret < 0) { VIR_FREE(*path); @@ -379,7 +379,7 @@ virPCIDeviceReadClass(virPCIDevicePtr dev, uint16_t *device_class) *device_class = (value >> 8) & 0xFFFF; ret = 0; -cleanup: + cleanup: VIR_FREE(id_str); VIR_FREE(path); return ret; @@ -746,7 +746,7 @@ virPCIDeviceIsParent(virPCIDevicePtr dev, virPCIDevicePtr check, void *data) } } -cleanup: + cleanup: virPCIDeviceConfigClose(check, fd); return ret; } @@ -838,7 +838,7 @@ virPCIDeviceTrySecondaryBusReset(virPCIDevicePtr dev, } ret = 0; -out: + out: virPCIDeviceConfigClose(parent, parentfd); virPCIDeviceFree(parent); return ret; @@ -972,7 +972,7 @@ virPCIDeviceReset(virPCIDevicePtr dev, _("no FLR, PM reset or bus reset available")); } -cleanup: + cleanup: VIR_FREE(drvPath); VIR_FREE(drvName); virPCIDeviceConfigClose(dev, fd); @@ -986,7 +986,7 @@ virPCIProbeStubDriver(const char *driver) char *drvpath = NULL; bool probed = false; -recheck: + recheck: if (virPCIDriverDir(&drvpath, driver) == 0 && virFileExists(drvpath)) { /* driver already loaded, return */ VIR_FREE(drvpath); @@ -1007,7 +1007,7 @@ recheck: goto recheck; } -cleanup: + cleanup: /* If we know failure was because of blacklist, let's report that; * otherwise, report a more generic failure message */ @@ -1056,7 +1056,7 @@ virPCIDeviceUnbind(virPCIDevicePtr dev, bool reprobe) } ret = 0; -cleanup: + cleanup: VIR_FREE(path); VIR_FREE(drvpath); VIR_FREE(driver); @@ -1109,7 +1109,7 @@ virPCIDeviceUnbindFromStub(virPCIDevicePtr dev) goto cleanup; dev->unbind_from_stub = false; -remove_slot: + remove_slot: if (!dev->remove_slot) goto reprobe; @@ -1126,7 +1126,7 @@ remove_slot: } dev->remove_slot = false; -reprobe: + reprobe: if (!dev->reprobe) { result = 0; goto cleanup; @@ -1151,7 +1151,7 @@ reprobe: result = 0; -cleanup: + cleanup: /* do not do it again */ dev->unbind_from_stub = false; dev->remove_slot = false; @@ -1257,7 +1257,7 @@ virPCIDeviceBindToStub(virPCIDevicePtr dev, result = 0; -remove_id: + remove_id: err = virSaveLastError(); /* If 'remove_id' exists, remove the device id from pci-stub's dynamic @@ -1289,7 +1289,7 @@ remove_id: goto cleanup; } -cleanup: + cleanup: VIR_FREE(stubDriverPath); VIR_FREE(driverLink); VIR_FREE(path); @@ -1534,7 +1534,7 @@ virPCIGetAddrString(unsigned int domain, ret = 0; } -cleanup: + cleanup: virPCIDeviceFree(dev); return ret; } @@ -1597,12 +1597,12 @@ virPCIDeviceNew(unsigned int domain, VIR_DEBUG("%s %s: initialized", dev->id, dev->name); -cleanup: + cleanup: VIR_FREE(product); VIR_FREE(vendor); return dev; -error: + error: virPCIDeviceFree(dev); dev = NULL; goto cleanup; @@ -1629,7 +1629,7 @@ virPCIDeviceCopy(virPCIDevicePtr dev) } return copy; -error: + error: virPCIDeviceFree(copy); return NULL; } @@ -1938,7 +1938,7 @@ int virPCIDeviceFileIterate(virPCIDevicePtr dev, ret = 0; -cleanup: + cleanup: if (dir) closedir(dir); VIR_FREE(file); @@ -1998,7 +1998,7 @@ virPCIDeviceAddressIOMMUGroupIterate(virPCIDeviceAddressPtr orig, ret = 0; -cleanup: + cleanup: VIR_FREE(groupPath); if (groupDir) closedir(groupDir); @@ -2022,7 +2022,7 @@ virPCIDeviceGetIOMMUGroupAddOne(virPCIDeviceAddressPtr newDevAddr, void *opaque) newDev = NULL; /* it's now on the list */ ret = 0; -cleanup: + cleanup: virPCIDeviceFree(newDev); return ret; } @@ -2051,7 +2051,7 @@ virPCIDeviceGetIOMMUGroupList(virPCIDevicePtr dev) return groupList; -error: + error: virObjectUnref(groupList); return NULL; } @@ -2081,7 +2081,7 @@ virPCIGetIOMMUGroupAddressesAddOne(virPCIDeviceAddressPtr newDevAddr, void *opaq goto cleanup; ret = 0; -cleanup: + cleanup: VIR_FREE(copyAddr); return ret; } @@ -2109,7 +2109,7 @@ virPCIDeviceAddressGetIOMMUGroupAddresses(virPCIDeviceAddressPtr devAddr, goto cleanup; ret = 0; -cleanup: + cleanup: return ret; } @@ -2156,7 +2156,7 @@ virPCIDeviceAddressGetIOMMUGroupNum(virPCIDeviceAddressPtr addr) } ret = groupNum; -cleanup: + cleanup: VIR_FREE(devName); VIR_FREE(devPath); VIR_FREE(groupPath); @@ -2191,7 +2191,7 @@ virPCIDeviceGetIOMMUGroupDev(virPCIDevicePtr dev) if (virAsprintf(&groupDev, "/dev/vfio/%s", last_component(groupPath)) < 0) goto cleanup; -cleanup: + cleanup: VIR_FREE(devPath); VIR_FREE(groupPath); return groupDev; @@ -2241,7 +2241,7 @@ virPCIDeviceDownstreamLacksACS(virPCIDevicePtr dev) goto cleanup; } -cleanup: + cleanup: virPCIDeviceConfigClose(dev, fd); return ret; } @@ -2374,7 +2374,7 @@ virPCIDeviceAddressParse(char *address, ret = 0; -out: + out: return ret; } @@ -2439,7 +2439,7 @@ virPCIGetDeviceAddressFromSysfsLink(const char *device_link, ret = 0; -out: + out: VIR_FREE(device_path); return ret; @@ -2514,12 +2514,12 @@ virPCIGetVirtualFunctions(const char *sysfs_path, } while (1); ret = 0; -cleanup: + cleanup: VIR_FREE(device_link); VIR_FREE(config_addr); return ret; -error: + error: for (i = 0; i < *num_virtual_functions; i++) VIR_FREE((*virtual_functions)[i]); VIR_FREE(*virtual_functions); @@ -2581,7 +2581,7 @@ virPCIGetVirtualFunctionIndex(const char *pf_sysfs_device_link, } } -out: + out: /* free virtual functions */ for (i = 0; i < num_virt_fns; i++) @@ -2651,7 +2651,7 @@ virPCIGetNetName(char *device_link_sysfs_path, char **netname) closedir(dir); -out: + out: VIR_FREE(pcidev_sysfs_net_path); return ret; @@ -2681,7 +2681,7 @@ virPCIGetVirtualFunctionInfo(const char *vf_sysfs_device_path, ret = virPCIGetNetName(pf_sysfs_device_path, pfname); -cleanup: + cleanup: VIR_FREE(pf_config_address); VIR_FREE(pf_sysfs_device_path); diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c index 0d08f1f..1d9a1c5 100644 --- a/src/util/virpidfile.c +++ b/src/util/virpidfile.c @@ -77,7 +77,7 @@ int virPidFileWritePath(const char *pidfile, rc = 0; -cleanup: + cleanup: if (VIR_CLOSE(fd) < 0) rc = -errno; @@ -109,7 +109,7 @@ int virPidFileWrite(const char *dir, rc = virPidFileWritePath(pidfile, pid); -cleanup: + cleanup: VIR_FREE(pidfile); return rc; } @@ -150,7 +150,7 @@ int virPidFileReadPath(const char *path, *pid = pid_value; rc = 0; -cleanup: + cleanup: if (VIR_CLOSE(fd) < 0) rc = -errno; @@ -282,7 +282,7 @@ int virPidFileReadPathIfAlive(const char *path, ret = STREQ(resolvedBinPath, resolvedProcLink) ? 0 : -1; -cleanup: + cleanup: VIR_FREE(procPath); VIR_FREE(procLink); VIR_FREE(resolvedProcLink); @@ -333,7 +333,7 @@ int virPidFileReadIfAlive(const char *dir, rc = virPidFileReadPathIfAlive(pidfile, pid, binpath); -cleanup: + cleanup: VIR_FREE(pidfile); return rc; } @@ -368,7 +368,7 @@ int virPidFileDelete(const char *dir, rc = virPidFileDeletePath(pidfile); -cleanup: + cleanup: VIR_FREE(pidfile); return rc; } @@ -469,7 +469,7 @@ int virPidFileAcquire(const char *dir, rc = virPidFileAcquirePath(pidfile, waitForLock, pid); -cleanup: + cleanup: VIR_FREE(pidfile); return rc; } @@ -517,7 +517,7 @@ int virPidFileRelease(const char *dir, rc = virPidFileReleasePath(pidfile, fd); -cleanup: + cleanup: VIR_FREE(pidfile); return rc; } diff --git a/src/util/virportallocator.c b/src/util/virportallocator.c index 22cdc37..ed7bdc2 100644 --- a/src/util/virportallocator.c +++ b/src/util/virportallocator.c @@ -168,7 +168,7 @@ static int virPortAllocatorBindToPort(bool *used, } ret = 0; -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); return ret; } @@ -217,7 +217,7 @@ int virPortAllocatorAcquire(virPortAllocatorPtr pa, _("Unable to find an unused port in range '%s' (%d-%d)"), pa->name, pa->start, pa->end); } -cleanup: + cleanup: virObjectUnlock(pa); return ret; } @@ -248,7 +248,7 @@ int virPortAllocatorRelease(virPortAllocatorPtr pa, } ret = 0; -cleanup: + cleanup: virObjectUnlock(pa); return ret; } diff --git a/src/util/virprocess.c b/src/util/virprocess.c index 5032886..405ad06 100644 --- a/src/util/virprocess.c +++ b/src/util/virprocess.c @@ -139,7 +139,7 @@ virProcessAbort(pid_t pid) } VIR_DEBUG("failed to reap child %lld, abandoning it", (long long) pid); -cleanup: + cleanup: VIR_FREE(tmp); errno = saved_errno; } @@ -210,7 +210,7 @@ virProcessWait(pid_t pid, int *exitstatus, bool raw) return 0; -error: + error: { char *st = virProcessTranslateStatus(status); virReportError(VIR_ERR_INTERNAL_ERROR, @@ -341,7 +341,7 @@ virProcessKillPainfully(pid_t pid, bool force) _("Failed to terminate process %lld with SIG%s"), (long long)pid, signame); -cleanup: + cleanup: return ret; } @@ -365,7 +365,7 @@ int virProcessSetAffinity(pid_t pid, virBitmapPtr map) * * http://lkml.org/lkml/2009/7/28/620 */ -realloc: + realloc: masklen = CPU_ALLOC_SIZE(numcpus); mask = CPU_ALLOC(numcpus); @@ -434,7 +434,7 @@ int virProcessGetAffinity(pid_t pid, * * http://lkml.org/lkml/2009/7/28/620 */ -realloc: + realloc: masklen = CPU_ALLOC_SIZE(numcpus); mask = CPU_ALLOC(numcpus); @@ -591,7 +591,7 @@ int virProcessGetNamespaces(pid_t pid, ret = 0; -cleanup: + cleanup: VIR_FREE(nsfile); if (ret < 0) { for (i = 0; i < *nfdlist; i++) @@ -856,7 +856,7 @@ int virProcessGetStartTime(pid_t pid, ret = 0; -cleanup: + cleanup: virStringFreeList(tokens); VIR_FREE(filename); VIR_FREE(buf); @@ -984,7 +984,7 @@ virProcessRunInMountNamespace(pid_t pid, VIR_FREE(buf); } -cleanup: + cleanup: VIR_FORCE_CLOSE(errfd[0]); VIR_FORCE_CLOSE(errfd[1]); return ret; diff --git a/src/util/virscsi.c b/src/util/virscsi.c index 81a294d..572b818 100644 --- a/src/util/virscsi.c +++ b/src/util/virscsi.c @@ -141,7 +141,7 @@ virSCSIDeviceGetSgName(const char *sysfs_prefix, goto cleanup; } -cleanup: + cleanup: closedir(dir); VIR_FREE(path); return sg; @@ -186,7 +186,7 @@ virSCSIDeviceGetDevName(const char *sysfs_prefix, break; } -cleanup: + cleanup: closedir(dir); VIR_FREE(path); return name; @@ -256,7 +256,7 @@ virSCSIDeviceNew(const char *sysfs_prefix, goto cleanup; ret = dev; -cleanup: + cleanup: VIR_FREE(sg); VIR_FREE(vendor); VIR_FREE(model); @@ -309,7 +309,7 @@ virSCSIDeviceSetUsedBy(virSCSIDevicePtr dev, return 0; -cleanup: + cleanup: virSCSIDeviceUsedByInfoFree(copy); return -1; } diff --git a/src/util/virsexpr.c b/src/util/virsexpr.c index a4c8997..e2eb873 100644 --- a/src/util/virsexpr.c +++ b/src/util/virsexpr.c @@ -342,7 +342,7 @@ _string2sexpr(const char *buffer, size_t * end) return ret; - error: + error: sexpr_free(ret); return NULL; } @@ -430,7 +430,7 @@ sexpr_lookup_key(const struct sexpr *sexpr, const char *node) result = (struct sexpr *) sexpr; -cleanup: + cleanup: VIR_FREE(buffer); return result; diff --git a/src/util/virsocketaddr.c b/src/util/virsocketaddr.c index 64669ad..20806e2 100644 --- a/src/util/virsocketaddr.c +++ b/src/util/virsocketaddr.c @@ -343,7 +343,7 @@ virSocketAddrFormatFull(const virSocketAddr *addr, return addrstr; -error: + error: return NULL; } @@ -802,7 +802,7 @@ virSocketAddrPrefixToNetmask(unsigned int prefix, result = 0; } -error: + error: return result; } diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 92a9366..c7384d1 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -317,7 +317,7 @@ qcow2GetBackingStoreFormat(int *format, offset += len; } -done: + done: return 0; } @@ -484,7 +484,7 @@ vmdk4GetBackingStore(char **res, ret = BACKING_STORE_OK; -cleanup: + cleanup: VIR_FREE(desc); return ret; } @@ -584,7 +584,7 @@ virFindBackingFile(const char *start, bool start_is_dir, const char *path, ret = 0; -cleanup: + cleanup: if (combined != path) VIR_FREE(combined); return ret; @@ -714,7 +714,7 @@ virStorageFileProbeFormatFromBuf(const char *path, } } -cleanup: + cleanup: VIR_DEBUG("format=%d", format); return format; } @@ -868,11 +868,11 @@ virStorageFileGetMetadataInternal(const char *path, VIR_STRDUP(meta->compat, "1.1") < 0) goto cleanup; -done: + done: ret = meta; meta = NULL; -cleanup: + cleanup: virStorageFileFreeMetadata(meta); return ret; } @@ -928,7 +928,7 @@ virStorageFileProbeFormat(const char *path, uid_t uid, gid_t gid) ret = virStorageFileProbeFormatFromBuf(path, header, len); -cleanup: + cleanup: VIR_FREE(header); VIR_FORCE_CLOSE(fd); @@ -1004,7 +1004,7 @@ virStorageFileGetMetadataFromFDInternal(const char *path, } ret = virStorageFileGetMetadataInternal(path, buf, len, directory, format); -cleanup: + cleanup: VIR_FREE(buf); return ret; } @@ -1163,7 +1163,7 @@ virStorageFileChainGetBroken(virStorageFileMetadataPtr chain, ret = 0; -error: + error: return ret; } @@ -1248,7 +1248,7 @@ virStorageFileResize(const char *path, ret = 0; -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); return ret; } @@ -1423,7 +1423,7 @@ int virStorageFileGetLVMKey(const char *path, ret = 0; -cleanup: + cleanup: if (*key && STREQ(*key, "")) VIR_FREE(*key); @@ -1473,7 +1473,7 @@ int virStorageFileGetSCSIKey(const char *path, ret = 0; -cleanup: + cleanup: if (*key && STREQ(*key, "")) VIR_FREE(*key); @@ -1550,7 +1550,7 @@ virStorageFileChainLookup(virStorageFileMetadataPtr chain, const char *start, *meta = owner->backingMeta; return owner->backingStore; -error: + error: *parent = NULL; if (meta) *meta = NULL; diff --git a/src/util/virstring.c b/src/util/virstring.c index 9256de7..b2184f3 100644 --- a/src/util/virstring.c +++ b/src/util/virstring.c @@ -111,7 +111,7 @@ char **virStringSplit(const char *string, return tokens; -error: + error: for (i = 0; i < ntokens; i++) VIR_FREE(tokens[i]); VIR_FREE(tokens); @@ -743,7 +743,7 @@ virStringSearch(const char *str, ret = nmatches - 1; /* don't count the trailing null */ -cleanup: + cleanup: regfree(&re); if (ret < 0) { virStringFreeList(*matches); diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c index 512310f..7b16157 100644 --- a/src/util/virsysinfo.c +++ b/src/util/virsysinfo.c @@ -239,7 +239,7 @@ virSysinfoRead(void) return ret; -no_memory: + no_memory: VIR_FREE(outbuf); return NULL; } @@ -325,7 +325,7 @@ virSysinfoParseProcessor(const char *base, virSysinfoDefPtr ret) VIR_FREE(processor_type); return 0; -error: + error: VIR_FREE(processor_type); return -1; } @@ -357,7 +357,7 @@ virSysinfoRead(void) return ret; -no_memory: + no_memory: VIR_FREE(outbuf); return NULL; } @@ -452,7 +452,7 @@ virSysinfoParseProcessor(const char *base, virSysinfoDefPtr ret) } result = 0; -cleanup: + cleanup: VIR_FREE(manufacturer); VIR_FREE(procline); return result; @@ -496,7 +496,7 @@ virSysinfoRead(void) return ret; -no_memory: + no_memory: virSysinfoDefFree(ret); VIR_FREE(outbuf); return NULL; @@ -864,13 +864,13 @@ virSysinfoRead(void) if (virSysinfoParseMemory(outbuf, ret) < 0) goto error; -cleanup: + cleanup: VIR_FREE(outbuf); virCommandFree(cmd); return ret; -error: + error: virSysinfoDefFree(ret); ret = NULL; goto cleanup; @@ -1119,6 +1119,6 @@ bool virSysinfoIsEqual(virSysinfoDefPtr src, identical = true; -cleanup: + cleanup: return identical; } diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c index 0281158..93b3f9c 100644 --- a/src/util/virsystemd.c +++ b/src/util/virsystemd.c @@ -137,7 +137,7 @@ char *virSystemdMakeMachineName(const char *name, goto cleanup; } -cleanup: + cleanup: VIR_FREE(username); return machinename; @@ -260,7 +260,7 @@ int virSystemdCreateMachine(const char *name, ret = 0; -cleanup: + cleanup: VIR_FREE(creatorname); VIR_FREE(machinename); VIR_FREE(slicename); @@ -313,7 +313,7 @@ int virSystemdTerminateMachine(const char *name, ret = 0; -cleanup: + cleanup: VIR_FREE(machinename); return ret; } diff --git a/src/util/virthread.c b/src/util/virthread.c index f0e14fc..7e841d1 100644 --- a/src/util/virthread.c +++ b/src/util/virthread.c @@ -229,7 +229,7 @@ int virThreadCreate(virThreadPtr thread, /* New thread owns 'args' in success case, so don't free */ ret = 0; -cleanup: + cleanup: pthread_attr_destroy(&attr); if (ret < 0) errno = err; diff --git a/src/util/virthreadpool.c b/src/util/virthreadpool.c index 57a7f76..4c46f28 100644 --- a/src/util/virthreadpool.c +++ b/src/util/virthreadpool.c @@ -147,7 +147,7 @@ static void virThreadPoolWorker(void *opaque) virMutexLock(&pool->mutex); } -out: + out: if (priority) pool->nPrioWorkers--; else @@ -231,7 +231,7 @@ virThreadPoolPtr virThreadPoolNew(size_t minWorkers, return pool; -error: + error: VIR_FREE(data); virThreadPoolFree(pool); return NULL; @@ -366,7 +366,7 @@ int virThreadPoolSendJob(virThreadPoolPtr pool, virMutexUnlock(&pool->mutex); return 0; -error: + error: virMutexUnlock(&pool->mutex); return -1; } diff --git a/src/util/virtpm.c b/src/util/virtpm.c index f431604..88f8361 100644 --- a/src/util/virtpm.c +++ b/src/util/virtpm.c @@ -58,6 +58,6 @@ virTPMCreateCancelPath(const char *devpath) _("Missing TPM device path")); } -cleanup: + cleanup: return path; } diff --git a/src/util/virtypedparam.c b/src/util/virtypedparam.c index 7e8ea7f..668a7df 100644 --- a/src/util/virtypedparam.c +++ b/src/util/virtypedparam.c @@ -108,7 +108,7 @@ virTypedParamsValidate(virTypedParameterPtr params, int nparams, ...) } ret = 0; -cleanup: + cleanup: va_end(ap); return ret; @@ -227,7 +227,7 @@ virTypedParameterAssign(virTypedParameterPtr param, const char *name, } ret = 0; -cleanup: + cleanup: va_end(ap); return ret; } @@ -321,7 +321,7 @@ virTypedParameterAssignFromStr(virTypedParameterPtr param, const char *name, } ret = 0; -cleanup: + cleanup: return ret; } @@ -381,7 +381,7 @@ virTypedParamsReplaceString(virTypedParameterPtr *params, *nparams = n; return 0; -error: + error: return -1; } @@ -769,7 +769,7 @@ virTypedParamsAddInt(virTypedParameterPtr *params, *nparams += 1; return 0; -error: + error: virDispatchError(NULL); return -1; } @@ -817,7 +817,7 @@ virTypedParamsAddUInt(virTypedParameterPtr *params, *nparams += 1; return 0; -error: + error: virDispatchError(NULL); return -1; } @@ -865,7 +865,7 @@ virTypedParamsAddLLong(virTypedParameterPtr *params, *nparams += 1; return 0; -error: + error: virDispatchError(NULL); return -1; } @@ -913,7 +913,7 @@ virTypedParamsAddULLong(virTypedParameterPtr *params, *nparams += 1; return 0; -error: + error: virDispatchError(NULL); return -1; } @@ -961,7 +961,7 @@ virTypedParamsAddDouble(virTypedParameterPtr *params, *nparams += 1; return 0; -error: + error: virDispatchError(NULL); return -1; } @@ -1009,7 +1009,7 @@ virTypedParamsAddBoolean(virTypedParameterPtr *params, *nparams += 1; return 0; -error: + error: virDispatchError(NULL); return -1; } @@ -1065,7 +1065,7 @@ virTypedParamsAddString(virTypedParameterPtr *params, *nparams += 1; return 0; -error: + error: virDispatchError(NULL); return -1; } @@ -1117,7 +1117,7 @@ virTypedParamsAddFromString(virTypedParameterPtr *params, *nparams += 1; return 0; -error: + error: virDispatchError(NULL); return -1; } diff --git a/src/util/viruri.c b/src/util/viruri.c index 35efad8..661ba76 100644 --- a/src/util/viruri.c +++ b/src/util/viruri.c @@ -50,7 +50,7 @@ virURIParamAppend(virURIPtr uri, return 0; -error: + error: VIR_FREE(pname); VIR_FREE(pvalue); return -1; @@ -210,7 +210,7 @@ virURIParse(const char *uri) return ret; -error: + error: xmlFreeURI(xmluri); virURIFree(ret); return NULL; @@ -264,7 +264,7 @@ virURIFormat(virURIPtr uri) goto cleanup; } -cleanup: + cleanup: VIR_FREE(tmpserver); return ret; diff --git a/src/util/virusb.c b/src/util/virusb.c index 1b6d76f..d959f5f 100644 --- a/src/util/virusb.c +++ b/src/util/virusb.c @@ -114,7 +114,7 @@ static int virUSBSysReadFile(const char *f_name, const char *d_name, } ret = 0; -cleanup: + cleanup: VIR_FREE(filename); VIR_FREE(buf); return ret; @@ -199,7 +199,7 @@ virUSBDeviceSearch(unsigned int vendor, } ret = list; -cleanup: + cleanup: if (dir) { int saved_errno = errno; closedir(dir); diff --git a/src/util/virutil.c b/src/util/virutil.c index 733cdff..9be1590 100644 --- a/src/util/virutil.c +++ b/src/util/virutil.c @@ -213,7 +213,7 @@ virPipeReadUntilEOF(int outfd, int errfd, return 0; -error: + error: VIR_FREE(*outbuf); VIR_FREE(*errbuf); return -1; @@ -649,7 +649,7 @@ char *virGetHostname(void) freeaddrinfo(info); -cleanup: + cleanup: return result; } @@ -721,7 +721,7 @@ virGetUserEnt(uid_t uid, char **name, gid_t *group, char **dir) } ret = 0; -cleanup: + cleanup: VIR_FREE(strbuf); return ret; } @@ -883,7 +883,7 @@ virGetUserIDByName(const char *name, uid_t *uid) *uid = pw->pw_uid; ret = 0; -cleanup: + cleanup: VIR_FREE(strbuf); return ret; @@ -963,7 +963,7 @@ virGetGroupIDByName(const char *name, gid_t *gid) *gid = gr->gr_gid; ret = 0; -cleanup: + cleanup: VIR_FREE(strbuf); return ret; @@ -1043,7 +1043,7 @@ virGetGroupList(uid_t uid, gid_t gid, gid_t **list) } } -cleanup: + cleanup: VIR_FREE(user); return ret; } @@ -1426,7 +1426,7 @@ virSetUIDGIDWithCaps(uid_t uid, gid_t gid, gid_t *groups, int ngroups, } ret = 0; -cleanup: + cleanup: return ret; } @@ -1610,7 +1610,7 @@ virSetDeviceUnprivSGIO(const char *path, } ret = 0; -cleanup: + cleanup: VIR_FREE(sysfs_path); VIR_FREE(val); return ret; @@ -1648,7 +1648,7 @@ virGetDeviceUnprivSGIO(const char *path, } ret = 0; -cleanup: + cleanup: VIR_FREE(sysfs_path); VIR_FREE(buf); return ret; @@ -1701,7 +1701,7 @@ virReadFCHost(const char *sysfs_prefix, goto cleanup; ret = 0; -cleanup: + cleanup: VIR_FREE(sysfs_path); VIR_FREE(buf); return ret; @@ -1752,7 +1752,7 @@ virIsCapableVport(const char *sysfs_prefix, virFileExists(scsi_host_path)) ret = true; -cleanup: + cleanup: VIR_FREE(fc_host_path); VIR_FREE(scsi_host_path); return ret; @@ -1819,7 +1819,7 @@ virManageVport(const int parent_host, "vport create/delete failed"), vport_name, operation_path); -cleanup: + cleanup: VIR_FREE(vport_name); VIR_FREE(operation_path); return ret; @@ -1913,7 +1913,7 @@ virGetFCHostNameByWWN(const char *sysfs_prefix, break; } -cleanup: + cleanup: # undef READ_WWN closedir(dir); VIR_FREE(wwnn_path); @@ -2003,7 +2003,7 @@ virFindFCHostCapableVport(const char *sysfs_prefix) VIR_FREE(vports); } -cleanup: + cleanup: closedir(dir); VIR_FREE(max_vports); VIR_FREE(vports); @@ -2137,7 +2137,7 @@ virParseOwnershipIds(const char *label, uid_t *uidPtr, gid_t *gidPtr) rc = 0; -cleanup: + cleanup: VIR_FREE(tmp_label); return rc; diff --git a/src/util/virxml.c b/src/util/virxml.c index dd530a6..9f00f62 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -771,12 +771,12 @@ virXMLParseHelper(int domcode, (*ctxt)->node = xmlDocGetRootElement(xml); } -cleanup: + cleanup: xmlFreeParserCtxt(pctxt); return xml; -error: + error: xmlFreeDoc(xml); xml = NULL; @@ -923,7 +923,7 @@ virXMLNodeToString(xmlDocPtr doc, ignore_value(VIR_STRDUP(ret, (const char *)xmlBufferContent(xmlbuf))); -cleanup: + cleanup: xmlBufferFree(xmlbuf); return ret; @@ -1044,7 +1044,7 @@ virXMLExtractNamespaceXML(xmlNodePtr root, ret = 0; -cleanup: + cleanup: if (doc) *doc = xmlstr; else -- 1.8.3.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list