diff --git a/tools/virsh-console.c b/tools/virsh-console.c index 34a0578ca5..9838a5685f 100644 --- a/tools/virsh-console.c +++ b/tools/virsh-console.c @@ -389,7 +389,7 @@ vshRunConsole(vshControl *ctl, ret = 0; -cleanup: + cleanup: virConsoleFree(con); /* Restore original signal handlers */ @@ -399,7 +399,7 @@ cleanup: sigaction(SIGHUP, &old_sighup, NULL); sigaction(SIGPIPE, &old_sigpipe, NULL); -resettty: + resettty: /* Put STDIN back into the (sane?) state we found it in before starting */ vshTTYRestore(ctl); diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index f47442295a..b0d79b9206 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -105,7 +105,7 @@ vshGetDomainDescription(vshControl *ctl, virDomainPtr dom, bool title, if (!desc) desc = vshStrdup(ctl, ""); -cleanup: + cleanup: VIR_FREE(domxml); xmlXPathFreeContext(ctxt); xmlFreeDoc(doc); @@ -370,7 +370,7 @@ cmdDomMemStat(vshControl *ctl, const vshCmd *cmd) } ret = true; -cleanup: + cleanup: virDomainFree(dom); return ret; } @@ -425,7 +425,7 @@ cmdDomblkinfo(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: virDomainFree(dom); return ret; } @@ -547,7 +547,7 @@ cmdDomblklist(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: VIR_FREE(disks); virDomainFree(dom); VIR_FREE(xml); @@ -648,7 +648,7 @@ cmdDomiflist(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: VIR_FREE(interfaces); virDomainFree(dom); VIR_FREE(xml); @@ -760,7 +760,7 @@ cmdDomIfGetLink(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: VIR_FREE(desc); VIR_FREE(state); VIR_FREE(interfaces); @@ -819,7 +819,7 @@ cmdDomControl(vshControl *ctl, const vshCmd *cmd) vshDomainControlStateToString(info.state)); } -cleanup: + cleanup: virDomainFree(dom); return ret; } @@ -1008,7 +1008,7 @@ cmdDomblkstat(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: VIR_FREE(params); virDomainFree(dom); return ret; @@ -1087,7 +1087,7 @@ cmdDomIfstat(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: virDomainFree(dom); return ret; } @@ -1151,7 +1151,7 @@ cmdDomBlkError(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: VIR_FREE(disks); virDomainFree(dom); return ret; @@ -1350,7 +1350,7 @@ cmdDomstate(vshControl *ctl, const vshCmd *cmd) vshDomainStateToString(state)); } -cleanup: + cleanup: virDomainFree(dom); return ret; } @@ -1474,7 +1474,7 @@ vshDomainListCollect(vshControl *ctl, unsigned int flags) goto cleanup; -fallback: + fallback: /* fall back to old method (0.9.12 and older) */ vshResetLibvirtError(); @@ -1534,7 +1534,7 @@ fallback: /* truncate domains that weren't found */ deleted = (nids + nnames) - list->ndomains; -filter: + filter: /* filter list the list if the list was acquired by fallback means */ for (i = 0; i < list->ndomains; i++) { dom = list->domains[i]; @@ -1610,14 +1610,14 @@ filter: /* the domain matched all filters, it may stay */ continue; -remove_entry: + remove_entry: /* the domain has to be removed as it failed one of the filters */ virDomainFree(list->domains[i]); list->domains[i] = NULL; deleted++; } -finished: + finished: /* sort the list */ if (list->domains && list->ndomains) qsort(list->domains, list->ndomains, sizeof(*list->domains), @@ -1629,7 +1629,7 @@ finished: success = true; -cleanup: + cleanup: for (i = 0; nnames != -1 && i < nnames; i++) VIR_FREE(names[i]); @@ -1838,7 +1838,7 @@ cmdList(vshControl *ctl, const vshCmd *cmd) } ret = true; -cleanup: + cleanup: vshDomainListFree(list); return ret; } diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index f2856a5eda..d9aa4fa51d 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -243,7 +243,7 @@ cmdAttachDevice(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, "%s", _("Device attached successfully\n")); ret = true; -cleanup: + cleanup: virDomainFree(dom); return ret; } @@ -939,7 +939,7 @@ cmdAttachInterface(vshControl *ctl, const vshCmd *cmd) functionReturn = true; } -cleanup: + cleanup: virDomainFree(dom); virBufferFreeAndReset(&buf); return functionReturn; @@ -1205,19 +1205,19 @@ cmdBlkdeviotune(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: virTypedParamsFree(params, nparams); if (dom) virDomainFree(dom); return ret; -save_error: + save_error: vshSaveLibvirtError(); -error: + error: vshError(ctl, "%s", _("Unable to change block I/O throttle")); goto cleanup; -interror: + interror: vshError(ctl, "%s", _("Unable to parse integer parameter")); goto cleanup; } @@ -1417,14 +1417,14 @@ cmdBlkiotune(vshControl * ctl, const vshCmd * cmd) ret = true; -cleanup: + cleanup: virTypedParamsFree(params, nparams); virDomainFree(dom); return ret; -save_error: + save_error: vshSaveLibvirtError(); -error: + error: vshError(ctl, "%s", _("Unable to change blkio parameters")); goto cleanup; } @@ -1507,7 +1507,7 @@ blockJobImpl(vshControl *ctl, const vshCmd *cmd, ret = virDomainBlockRebase(dom, path, base, bandwidth, flags); } -cleanup: + cleanup: if (pdom && ret == 0) *pdom = dom; else if (dom) @@ -1712,7 +1712,7 @@ cmdBlockCommit(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, "\n%s", quit ? _("Commit aborted") : _("Commit complete")); ret = true; -cleanup: + cleanup: if (dom) virDomainFree(dom); if (blocking) @@ -1907,7 +1907,7 @@ cmdBlockCopy(vshControl *ctl, const vshCmd *cmd) _("Now in mirroring phase")); ret = true; -cleanup: + cleanup: if (dom) virDomainFree(dom); if (blocking) @@ -2163,7 +2163,7 @@ cmdBlockPull(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, "\n%s", quit ? _("Pull aborted") : _("Pull complete")); ret = true; -cleanup: + cleanup: if (dom) virDomainFree(dom); if (blocking) @@ -2332,7 +2332,7 @@ cmdConsole(vshControl *ctl, const vshCmd *cmd) ret = cmdRunConsole(ctl, dom, name, flags); -cleanup: + cleanup: virDomainFree(dom); return ret; } @@ -2473,7 +2473,7 @@ cmdDomIfSetLink(vshControl *ctl, const vshCmd *cmd) vshError(ctl, _("interface (%s: %s) not found"), element, iface); goto cleanup; -hit: + hit: /* find and modify/add link state node */ /* try to find element */ cur = obj->nodesetval->nodeTab[i]->children; @@ -2516,7 +2516,7 @@ hit: ret = true; } -cleanup: + cleanup: xmlXPathFreeObject(obj); xmlXPathFreeContext(ctxt); xmlFreeDoc(xml); @@ -2700,14 +2700,14 @@ cmdDomIftune(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: virTypedParamsFree(params, nparams); virDomainFree(dom); return ret; -save_error: + save_error: vshSaveLibvirtError(); -error: + error: vshError(ctl, "%s", _("Unable to set interface parameters")); goto cleanup; } @@ -2835,7 +2835,7 @@ cmdDomPMSuspend(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: virDomainFree(dom); return ret; } @@ -2886,7 +2886,7 @@ cmdDomPMWakeup(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: virDomainFree(dom); return ret; } @@ -3217,7 +3217,7 @@ cmdUndefine(vshControl *ctl, const vshCmd *cmd) rc = virDomainUndefine(dom); -out: + out: if (rc == 0) { vshPrint(ctl, _("Domain %s has been undefined\n"), name); ret = true; @@ -3254,7 +3254,7 @@ out: } } -cleanup: + cleanup: VIR_FREE(source); VIR_FREE(target); VIR_FREE(pool); @@ -3277,7 +3277,7 @@ cleanup: virDomainFree(dom); return ret; -error: + error: vshReportError(ctl); goto cleanup; } @@ -3374,7 +3374,7 @@ cmdStartGetFDs(vshControl *ctl, *nfdsret = nfds; return 0; -error: + error: virStringFreeList(fdlist); VIR_FREE(fds); return -1; @@ -3447,7 +3447,7 @@ cmdStart(vshControl *ctl, const vshCmd *cmd) goto cleanup; } -started: + started: vshPrint(ctl, _("Domain %s started\n"), virDomainGetName(dom)); #ifndef WIN32 @@ -3457,7 +3457,7 @@ started: ret = true; -cleanup: + cleanup: virDomainFree(dom); VIR_FREE(fds); return ret; @@ -3561,9 +3561,9 @@ doSave(void *opaque) ret = '0'; -out: + out: pthread_sigmask(SIG_SETMASK, &oldsigmask, NULL); -out_sig: + out_sig: if (dom) virDomainFree(dom); VIR_FREE(xml); ignore_value(safewrite(data->writefd, &ret, sizeof(ret))); @@ -3680,7 +3680,7 @@ vshWatchJob(vshControl *ctl, functionReturn = true; -cleanup: + cleanup: sigaction(SIGINT, &old_sig_action, NULL); vshTTYRestore(ctl); return functionReturn; @@ -3727,7 +3727,7 @@ cmdSave(vshControl *ctl, const vshCmd *cmd) if (ret) vshPrint(ctl, _("\nDomain %s saved to %s\n"), name, to); -cleanup: + cleanup: if (dom) virDomainFree(dom); return ret; @@ -3780,7 +3780,7 @@ cmdSaveImageDumpxml(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, "%s", xml); ret = true; -cleanup: + cleanup: VIR_FREE(xml); return ret; } @@ -3851,7 +3851,7 @@ cmdSaveImageDefine(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, _("State file %s updated.\n"), file); ret = true; -cleanup: + cleanup: VIR_FREE(xml); return ret; } @@ -3925,7 +3925,7 @@ cmdSaveImageEdit(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, _("State file %s edited.\n"), file); ret = true; -cleanup: + cleanup: return ret; } @@ -4003,9 +4003,9 @@ doManagedsave(void *opaque) } ret = '0'; -out: + out: pthread_sigmask(SIG_SETMASK, &oldsigmask, NULL); -out_sig: + out_sig: if (dom) virDomainFree(dom); ignore_value(safewrite(data->writefd, &ret, sizeof(ret))); @@ -4049,7 +4049,7 @@ cmdManagedSave(vshControl *ctl, const vshCmd *cmd) if (ret) vshPrint(ctl, _("\nDomain %s state saved by libvirt\n"), name); -cleanup: + cleanup: virDomainFree(dom); VIR_FORCE_CLOSE(p[0]); VIR_FORCE_CLOSE(p[1]); @@ -4110,7 +4110,7 @@ cmdManagedSaveRemove(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: virDomainFree(dom); return ret; } @@ -4252,7 +4252,7 @@ cmdSchedInfoUpdate(vshControl *ctl, const vshCmd *cmd, *update_params = params; params = NULL; -cleanup: + cleanup: VIR_FREE(set_field); virTypedParamsFree(params, nparams); return ret; @@ -4437,7 +4437,7 @@ cmdRestore(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, _("Domain restored from %s\n"), from); ret = true; -cleanup: + cleanup: VIR_FREE(xml); return ret; } @@ -4571,9 +4571,9 @@ doDump(void *opaque) } ret = '0'; -out: + out: pthread_sigmask(SIG_SETMASK, &oldsigmask, NULL); -out_sig: + out_sig: if (dom) virDomainFree(dom); ignore_value(safewrite(data->writefd, &ret, sizeof(ret))); @@ -4620,7 +4620,7 @@ cmdDump(vshControl *ctl, const vshCmd *cmd) if (ret) vshPrint(ctl, _("\nDomain %s dumped to %s\n"), name, to); -cleanup: + cleanup: virDomainFree(dom); VIR_FORCE_CLOSE(p[0]); VIR_FORCE_CLOSE(p[1]); @@ -4760,7 +4760,7 @@ cmdScreenshot(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, _("Screenshot saved to %s, with type of %s"), file, mime); ret = true; -cleanup: + cleanup: if (!ret && created) unlink(file); if (generated) @@ -4895,7 +4895,7 @@ cmdShutdown(vshControl *ctl, const vshCmd *cmd) } ret = true; -cleanup: + cleanup: if (dom) virDomainFree(dom); virStringFreeList(modes); @@ -4976,7 +4976,7 @@ cmdReboot(vshControl *ctl, const vshCmd *cmd) } ret = true; -cleanup: + cleanup: if (dom) virDomainFree(dom); virStringFreeList(modes); @@ -5238,12 +5238,12 @@ cmdDomjobinfo(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: virDomainFree(dom); virTypedParamsFree(params, nparams); return ret; -save_error: + save_error: vshSaveLibvirtError(); goto cleanup; } @@ -5413,7 +5413,7 @@ vshCPUCountCollect(vshControl *ctl, } ret = count; -cleanup: + cleanup: VIR_FREE(def); xmlXPathFreeContext(ctxt); xmlFreeDoc(xml); @@ -5492,7 +5492,7 @@ cmdVcpucount(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: virDomainFree(dom); return ret; } @@ -5773,9 +5773,9 @@ vshParseCPUList(vshControl *ctl, const char *cpulist, return cpumap; -error: + error: vshError(ctl, "%s", _("cpulist: Invalid format.")); -cleanup: + cleanup: VIR_FREE(cpumap); return NULL; } @@ -5887,7 +5887,7 @@ cmdVcpuPin(vshControl *ctl, const vshCmd *cmd) } ret = true; -cleanup: + cleanup: VIR_FREE(cpumap); virDomainFree(dom); return ret; @@ -6006,7 +6006,7 @@ cmdEmulatorPin(vshControl *ctl, const vshCmd *cmd) goto cleanup; ret = true; -cleanup: + cleanup: VIR_FREE(cpumap); virDomainFree(dom); return ret; @@ -6124,7 +6124,7 @@ cmdSetvcpus(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: virDomainFree(dom); return ret; } @@ -6214,7 +6214,7 @@ cmdCPUCompare(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: VIR_FREE(buffer); VIR_FREE(snippet); xmlXPathFreeContext(ctxt); @@ -6313,7 +6313,7 @@ cmdCPUBaseline(vshControl *ctl, const vshCmd *cmd) ret = true; } -cleanup: + cleanup: xmlXPathFreeContext(ctxt); xmlFreeDoc(xml); VIR_FREE(result); @@ -6327,7 +6327,7 @@ cleanup: return ret; -no_memory: + no_memory: vshError(ctl, "%s", _("Out of memory")); ret = false; goto cleanup; @@ -6477,7 +6477,7 @@ cmdCPUStats(vshControl *ctl, const vshCmd *cmd) goto cleanup; } -do_show_total: + do_show_total: /* get supported num of parameter for total statistics */ if ((nparams = virDomainGetCPUStats(dom, NULL, 0, -1, 1, flags)) < 0) goto failed_stats; @@ -6513,12 +6513,12 @@ do_show_total: ret = true; -cleanup: + cleanup: virTypedParamsFree(params, nparams); virDomainFree(dom); return ret; -failed_stats: + failed_stats: vshError(ctl, _("Failed to retrieve CPU statistics for domain '%s'"), virDomainGetName(dom)); goto cleanup; @@ -6611,7 +6611,7 @@ cmdCreate(vshControl *ctl, const vshCmd *cmd) virDomainFree(dom); ret = true; -cleanup: + cleanup: VIR_FREE(buffer); VIR_FREE(fds); return ret; @@ -6886,7 +6886,7 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd) } ret = true; -cleanup: + cleanup: VIR_FREE(desc_edited); VIR_FREE(desc); if (tmp) { @@ -7047,7 +7047,7 @@ cmdMetadata(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: virDomainFree(dom); return ret; } @@ -7188,7 +7188,7 @@ cmdSendKey(vshControl *ctl, const vshCmd *cmd) if (!(virDomainSendKey(dom, codeset, holdtime, keycodes, count, 0) < 0)) ret = true; -cleanup: + cleanup: virDomainFree(dom); return ret; } @@ -7264,7 +7264,7 @@ static int getSignalNumber(vshControl *ctl, const char *signame) goto cleanup; signum = -1; -cleanup: + cleanup: VIR_FREE(tmp); return signum; } @@ -7303,7 +7303,7 @@ cmdSendProcessSignal(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: virDomainFree(dom); return ret; } @@ -7691,14 +7691,14 @@ cmdMemtune(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: virTypedParamsFree(params, nparams); virDomainFree(dom); return ret; -save_error: + save_error: vshSaveLibvirtError(); -error: + error: vshError(ctl, "%s", _("Unable to change memory parameters")); goto cleanup; } @@ -7841,14 +7841,14 @@ cmdNumatune(vshControl * ctl, const vshCmd * cmd) ret = true; -cleanup: + cleanup: virTypedParamsFree(params, nparams); virDomainFree(dom); return ret; -save_error: + save_error: vshSaveLibvirtError(); -error: + error: vshError(ctl, "%s", _("Unable to change numa parameters")); goto cleanup; } @@ -7942,7 +7942,7 @@ cmdQemuMonitorCommand(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: VIR_FREE(result); VIR_FREE(monitor_cmd); virJSONValueFree(pretty); @@ -8083,7 +8083,7 @@ cmdQemuMonitorEvent(vshControl *ctl, const vshCmd *cmd) if (data.count) ret = true; -cleanup: + cleanup: vshEventCleanup(ctl); if (eventId >= 0 && virConnectDomainQemuMonitorEventDeregister(ctl->conn, eventId) < 0) @@ -8141,7 +8141,7 @@ cmdQemuAttach(vshControl *ctl, const vshCmd *cmd) vshError(ctl, _("Failed to attach to pid %u"), pid_value); } -cleanup: + cleanup: return ret; } @@ -8265,7 +8265,7 @@ cmdQemuAgentCommand(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: VIR_FREE(result); VIR_FREE(guest_agent_cmd); if (dom) @@ -8407,7 +8407,7 @@ cmdLxcEnterNamespace(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: VIR_FREE(seclabel); VIR_FREE(secmodel); if (dom) @@ -8982,16 +8982,16 @@ doMigrate(void *opaque) virConnectClose(dconn); } -out: + out: pthread_sigmask(SIG_SETMASK, &oldsigmask, NULL); -out_sig: + out_sig: virTypedParamsFree(params, nparams); if (dom) virDomainFree(dom); ignore_value(safewrite(data->writefd, &ret, sizeof(ret))); return; -save_error: + save_error: vshSaveLibvirtError(); goto out; } @@ -9051,7 +9051,7 @@ cmdMigrate(vshControl *ctl, const vshCmd *cmd) virThreadJoin(&workerThread); -cleanup: + cleanup: virDomainFree(dom); VIR_FORCE_CLOSE(p[0]); VIR_FORCE_CLOSE(p[1]); @@ -9106,7 +9106,7 @@ cmdMigrateSetMaxDowntime(vshControl *ctl, const vshCmd *cmd) ret = true; -done: + done: virDomainFree(dom); return ret; } @@ -9168,7 +9168,7 @@ cmdMigrateCompCache(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, _("Compression cache: %.3lf %s"), value, unit); ret = true; -cleanup: + cleanup: virDomainFree(dom); return ret; } @@ -9221,7 +9221,7 @@ cmdMigrateSetMaxSpeed(vshControl *ctl, const vshCmd *cmd) ret = true; -done: + done: virDomainFree(dom); return ret; } @@ -9265,7 +9265,7 @@ cmdMigrateGetMaxSpeed(vshControl *ctl, const vshCmd *cmd) ret = true; -done: + done: virDomainFree(dom); return ret; } @@ -9445,7 +9445,7 @@ cmdDomDisplay(vshControl *ctl, const vshCmd *cmd) break; } -cleanup: + cleanup: VIR_FREE(doc); VIR_FREE(xpath); VIR_FREE(passwd); @@ -9631,7 +9631,7 @@ cmdDomHostname(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, "%s\n", hostname); ret = true; -error: + error: VIR_FREE(hostname); virDomainFree(dom); return ret; @@ -9747,7 +9747,7 @@ vshNodeIsSuperset(xmlNodePtr n1, xmlNodePtr n2) ret = true; -cleanup: + cleanup: virBitmapFree(bitmap); return ret; } @@ -9848,7 +9848,7 @@ cmdDetachDevice(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, "%s", _("Device detached successfully\n")); funcRet = true; -cleanup: + cleanup: VIR_FREE(buffer); virDomainFree(dom); return funcRet; @@ -9950,7 +9950,7 @@ cmdUpdateDevice(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, "%s", _("Device updated successfully\n")); ret = true; -cleanup: + cleanup: VIR_FREE(buffer); virDomainFree(dom); return ret; @@ -10104,7 +10104,7 @@ cmdDetachInterface(vshControl *ctl, const vshCmd *cmd) goto cleanup; } -hit: + hit: if (!(detach_xml = virXMLNodeToString(xml, matchNode))) { vshSaveLibvirtError(); goto cleanup; @@ -10122,7 +10122,7 @@ hit: functionReturn = true; } -cleanup: + cleanup: VIR_FREE(doc); VIR_FREE(detach_xml); virDomainFree(dom); @@ -10220,7 +10220,7 @@ vshFindDisk(const char *doc, vshError(NULL, _("No disk found whose source path or target is %s"), path); -cleanup: + cleanup: xmlXPathFreeObject(obj); xmlXPathFreeContext(ctxt); xmlFreeDoc(xml); @@ -10319,7 +10319,7 @@ vshPrepareDiskXML(xmlNodePtr disk_node, goto cleanup; } -cleanup: + cleanup: VIR_FREE(device_type); VIR_FREE(disk_type); return ret; @@ -11162,7 +11162,7 @@ cmdEvent(vshControl *ctl, const vshCmd *cmd) if (count) ret = true; -cleanup: + cleanup: vshEventCleanup(ctl); if (data) { for (i = 0; i < (all ? VIR_DOMAIN_EVENT_ID_LAST : 1); i++) { @@ -11323,7 +11323,7 @@ cmdChangeMedia(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, _("succeeded to complete action %s on media\n"), action); ret = true; -cleanup: + cleanup: VIR_FREE(doc); xmlFreeNode(disk_node); VIR_FREE(disk_xml); @@ -11386,7 +11386,7 @@ cmdDomFSTrim(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: virDomainFree(dom); return ret; } diff --git a/tools/virsh-edit.c b/tools/virsh-edit.c index bb79853e08..5d35c55679 100644 --- a/tools/virsh-edit.c +++ b/tools/virsh-edit.c @@ -80,7 +80,7 @@ do { if (!tmp) goto edit_cleanup; -reedit: + reedit: /* Start the editor. */ if (vshEditFile(ctl, tmp) == -1) goto edit_cleanup; @@ -96,7 +96,7 @@ reedit: EDIT_NOT_CHANGED; } -redefine: + redefine: msg = NULL; /* Now re-read the object XML. Did someone else change it while @@ -144,7 +144,7 @@ redefine: edit_success = true; -edit_cleanup: + edit_cleanup: VIR_FREE(doc); VIR_FREE(doc_edited); VIR_FREE(doc_reread); diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 6a04f9d85a..cac6086e9b 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -182,7 +182,7 @@ cmdFreecell(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: xmlXPathFreeContext(ctxt); xmlFreeDoc(xml); VIR_FREE(nodes); @@ -302,7 +302,7 @@ cmdNodeCpuMap(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) ret = true; - cleanup: + cleanup: VIR_FREE(cpumap); return ret; } @@ -446,7 +446,7 @@ cmdNodeCpuStats(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: VIR_FREE(params); return ret; } @@ -511,7 +511,7 @@ cmdNodeMemStats(vshControl *ctl, const vshCmd *cmd) ret = true; - cleanup: + cleanup: VIR_FREE(params); return ret; } @@ -928,13 +928,13 @@ cmdNodeMemoryTune(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: virTypedParamsFree(params, nparams); return ret; -save_error: + save_error: vshSaveLibvirtError(); -error: + error: vshError(ctl, "%s", _("Unable to change memory parameters")); goto cleanup; } diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c index 147583ce3b..d4ec8540e0 100644 --- a/tools/virsh-interface.c +++ b/tools/virsh-interface.c @@ -138,7 +138,7 @@ cmdInterfaceEdit(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: if (iface) virInterfaceFree(iface); if (iface_edited) @@ -217,7 +217,7 @@ vshInterfaceListCollect(vshControl *ctl, goto cleanup; -fallback: + fallback: /* fall back to old method (0.10.1 and older) */ vshResetLibvirtError(); @@ -287,7 +287,7 @@ fallback: /* truncate interfaces that weren't found */ deleted = nAllIfaces - list->nifaces; -finished: + finished: /* sort the list */ if (list->ifaces && list->nifaces) qsort(list->ifaces, list->nifaces, @@ -299,7 +299,7 @@ finished: success = true; -cleanup: + cleanup: for (i = 0; nActiveIfaces != -1 && i < nActiveIfaces; i++) VIR_FREE(activeNames[i]); diff --git a/tools/virsh-network.c b/tools/virsh-network.c index 22d21e71ee..078a3cfb5b 100644 --- a/tools/virsh-network.c +++ b/tools/virsh-network.c @@ -480,7 +480,7 @@ vshNetworkListCollect(vshControl *ctl, goto cleanup; -fallback: + fallback: /* fall back to old method (0.10.1 and older) */ vshResetLibvirtError(); @@ -550,7 +550,7 @@ fallback: /* truncate networks that weren't found */ deleted = nAllNets - list->nnets; -filter: + filter: /* filter list the list if the list was acquired by fallback means */ for (i = 0; i < list->nnets; i++) { net = list->nets[i]; @@ -581,14 +581,14 @@ filter: /* the pool matched all filters, it may stay */ continue; -remove_entry: + remove_entry: /* the pool has to be removed as it failed one of the filters */ virNetworkFree(list->nets[i]); list->nets[i] = NULL; deleted++; } -finished: + finished: /* sort the list */ if (list->nets && list->nnets) qsort(list->nets, list->nnets, @@ -600,7 +600,7 @@ finished: success = true; -cleanup: + cleanup: for (i = 0; i < nAllNets; i++) VIR_FREE(names[i]); VIR_FREE(names); @@ -1007,7 +1007,7 @@ cmdNetworkUpdate(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, _("Updated network %s %s"), virNetworkGetName(network), affected); ret = true; -cleanup: + cleanup: vshReportError(ctl); virNetworkFree(network); VIR_FREE(xmlFromFile); @@ -1274,7 +1274,7 @@ cmdNetworkEvent(vshControl *ctl, const vshCmd *cmd) if (data.count) ret = true; -cleanup: + cleanup: vshEventCleanup(ctl); if (eventId >= 0 && virConnectNetworkEventDeregisterAny(ctl->conn, eventId) < 0) diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index ebfac94cb2..a35387a3ba 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -160,7 +160,7 @@ cmdNodeDeviceDestroy(vshControl *ctl, const vshCmd *cmd) } ret = true; -cleanup: + cleanup: virStringFreeList(arr); virNodeDeviceFree(dev); return ret; @@ -249,7 +249,7 @@ vshNodeDeviceListCollect(vshControl *ctl, goto cleanup; -fallback: + fallback: /* fall back to old method (0.10.1 and older) */ vshResetLibvirtError(); @@ -329,14 +329,14 @@ fallback: /* the device matched all filters, it may stay */ continue; -remove_entry: + remove_entry: /* the device has to be removed as it failed one of the filters */ virNodeDeviceFree(list->devices[i]); list->devices[i] = NULL; deleted++; } -finished: + finished: /* sort the list */ if (list->devices && list->ndevices) qsort(list->devices, list->ndevices, @@ -348,7 +348,7 @@ finished: success = true; -cleanup: + cleanup: for (i = 0; ndevices != -1 && i < ndevices; i++) VIR_FREE(names[i]); VIR_FREE(names); @@ -500,7 +500,7 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) vshPrint(ctl, "%s\n", virNodeDeviceGetName(list->devices[i])); } -cleanup: + cleanup: virStringFreeList(caps); vshNodeDeviceListFree(list); return ret; @@ -568,7 +568,7 @@ cmdNodeDeviceDumpXML(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, "%s\n", xml); ret = true; -cleanup: + cleanup: virStringFreeList(arr); VIR_FREE(xml); virNodeDeviceFree(device); diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c index 6f2c88cfb4..6e6e21b7d1 100644 --- a/tools/virsh-nwfilter.c +++ b/tools/virsh-nwfilter.c @@ -284,7 +284,7 @@ vshNWFilterListCollect(vshControl *ctl, goto cleanup; -fallback: + fallback: /* fall back to old method (0.9.13 and older) */ vshResetLibvirtError(); @@ -318,7 +318,7 @@ fallback: /* truncate network filters that weren't found */ deleted = nfilters - list->nfilters; -finished: + finished: /* sort the list */ if (list->filters && list->nfilters) qsort(list->filters, list->nfilters, @@ -330,7 +330,7 @@ finished: success = true; -cleanup: + cleanup: for (i = 0; nfilters != -1 && i < nfilters; i++) VIR_FREE(names[i]); VIR_FREE(names); @@ -438,7 +438,7 @@ cmdNWFilterEdit(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: if (nwfilter) virNWFilterFree(nwfilter); if (nwfilter_edited) diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index 700fdbe8f5..0d35cf5df4 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -290,7 +290,7 @@ vshBuildPoolXML(vshControl *ctl, *retname = name; return true; -cleanup: + cleanup: virBufferFreeAndReset(&buf); return false; } @@ -755,7 +755,7 @@ vshStoragePoolListCollect(vshControl *ctl, goto cleanup; -fallback: + fallback: /* fall back to old method (0.10.1 and older) */ vshResetLibvirtError(); @@ -832,7 +832,7 @@ fallback: /* truncate pools that weren't found */ deleted = nAllPools - list->npools; -filter: + filter: /* filter list the list if the list was acquired by fallback means */ for (i = 0; i < list->npools; i++) { pool = list->pools[i]; @@ -864,14 +864,14 @@ filter: /* the pool matched all filters, it may stay */ continue; -remove_entry: + remove_entry: /* the pool has to be removed as it failed one of the filters */ virStoragePoolFree(list->pools[i]); list->pools[i] = NULL; deleted++; } -finished: + finished: /* sort the list */ if (list->pools && list->npools) qsort(list->pools, list->npools, @@ -883,7 +883,7 @@ finished: success = true; -cleanup: + cleanup: for (i = 0; i < nAllPools; i++) VIR_FREE(names[i]); @@ -1305,7 +1305,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) /* Cleanup and return */ ret = true; -cleanup: + cleanup: VIR_FREE(outputStr); if (list && list->npools) { for (i = 0; i < list->npools; i++) { diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c index b5acfda732..10d5db3d4b 100644 --- a/tools/virsh-secret.c +++ b/tools/virsh-secret.c @@ -117,7 +117,7 @@ cmdSecretDefine(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, _("Secret %s created\n"), uuid); ret = true; -cleanup: + cleanup: VIR_FREE(buffer); if (res) virSecretFree(res); @@ -164,7 +164,7 @@ cmdSecretDumpXML(vshControl *ctl, const vshCmd *cmd) VIR_FREE(xml); ret = true; -cleanup: + cleanup: virSecretFree(secret); return ret; } @@ -232,7 +232,7 @@ cmdSecretSetValue(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, "%s", _("Secret value set\n")); ret = true; -cleanup: + cleanup: virSecretFree(secret); return ret; } @@ -289,7 +289,7 @@ cmdSecretGetValue(vshControl *ctl, const vshCmd *cmd) VIR_FREE(base64); ret = true; -cleanup: + cleanup: virSecretFree(secret); return ret; } @@ -334,7 +334,7 @@ cmdSecretUndefine(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, _("Secret %s deleted\n"), uuid); ret = true; -cleanup: + cleanup: virSecretFree(secret); return ret; } @@ -410,7 +410,7 @@ vshSecretListCollect(vshControl *ctl, goto cleanup; -fallback: + fallback: /* fall back to old method (0.10.1 and older) */ vshResetLibvirtError(); @@ -449,7 +449,7 @@ fallback: /* truncate secrets that weren't found */ deleted = nsecrets - list->nsecrets; -finished: + finished: /* sort the list */ if (list->secrets && list->nsecrets) qsort(list->secrets, list->nsecrets, @@ -461,7 +461,7 @@ finished: success = true; -cleanup: + cleanup: if (nsecrets > 0) { for (i = 0; i < nsecrets; i++) VIR_FREE(uuids[i]); @@ -559,7 +559,7 @@ cmdSecretList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) ret = true; -cleanup: + cleanup: vshSecretListFree(list); return ret; } diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 6beb25aa96..3ecb3def53 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -99,7 +99,7 @@ vshSnapshotCreate(vshControl *ctl, virDomainPtr dom, const char *buffer, ret = true; -cleanup: + cleanup: xmlXPathFreeContext(ctxt); xmlFreeDoc(xml); if (snapshot) @@ -214,7 +214,7 @@ cmdSnapshotCreate(vshControl *ctl, const vshCmd *cmd) ret = vshSnapshotCreate(ctl, dom, buffer, flags, from); -cleanup: + cleanup: VIR_FREE(buffer); if (dom) virDomainFree(dom); @@ -258,7 +258,7 @@ vshParseSnapshotMemspec(vshControl *ctl, virBufferPtr buf, const char *str) virBufferEscapeString(buf, " file='%s'", file); virBufferAddLit(buf, "/>\n"); ret = 0; -cleanup: + cleanup: if (ret < 0) vshError(ctl, _("unable to parse memspec: %s"), str); virStringFreeList(array); @@ -309,7 +309,7 @@ vshParseSnapshotDiskspec(vshControl *ctl, virBufferPtr buf, const char *str) virBufferAddLit(buf, "/>\n"); } ret = 0; -cleanup: + cleanup: if (ret < 0) vshError(ctl, _("unable to parse diskspec: %s"), str); virStringFreeList(array); @@ -464,7 +464,7 @@ cmdSnapshotCreateAs(vshControl *ctl, const vshCmd *cmd) ret = vshSnapshotCreate(ctl, dom, buffer, flags, NULL); -cleanup: + cleanup: virBufferFreeAndReset(&buf); VIR_FREE(buffer); virDomainFree(dom); @@ -620,7 +620,7 @@ cmdSnapshotEdit(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: if (!ret && name) vshError(ctl, _("Failed to update %s"), name); if (edited) @@ -739,7 +739,7 @@ cmdSnapshotCurrent(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: if (!ret) vshReportError(ctl); VIR_FREE(xml); @@ -795,7 +795,7 @@ vshGetSnapshotParent(vshControl *ctl, virDomainSnapshotPtr snapshot, *parent_name = virXPathString("string(/domainsnapshot/parent/name)", ctxt); ret = 0; -cleanup: + cleanup: if (ret < 0) { vshReportError(ctl); vshError(ctl, "%s", _("unable to determine if snapshot has parent")); @@ -859,7 +859,7 @@ vshSnapshotFilter(vshControl *ctl, virDomainSnapshotPtr snapshot, ret = !!(flags & VIR_DOMAIN_SNAPSHOT_LIST_ACTIVE); } -cleanup: + cleanup: VIR_FREE(state); xmlXPathFreeContext(ctxt); xmlFreeDoc(xmldoc); @@ -1030,7 +1030,7 @@ cmdSnapshotInfo(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: VIR_FREE(state); xmlXPathFreeContext(ctxt); xmlFreeDoc(xmldoc); @@ -1375,7 +1375,7 @@ vshSnapshotListCollect(vshControl *ctl, virDomainPtr dom, } } -success: + success: if (filter_fallback) { /* Older API didn't filter on status or location, but the * information is available in domain XML. */ @@ -1406,7 +1406,7 @@ success: ret = snaplist; snaplist = NULL; -cleanup: + cleanup: vshSnapshotListFree(snaplist); if (names && count > 0) for (i = 0; i < count; i++) @@ -1673,7 +1673,7 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: /* this frees up memory from the last iteration of the loop */ vshSnapshotListFree(snaplist); VIR_FREE(parent_snap); @@ -1747,7 +1747,7 @@ cmdSnapshotDumpXML(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, "%s", xml); ret = true; -cleanup: + cleanup: VIR_FREE(xml); if (snapshot) virDomainSnapshotFree(snapshot); @@ -1814,7 +1814,7 @@ cmdSnapshotParent(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: VIR_FREE(parent); if (snapshot) virDomainSnapshotFree(snapshot); @@ -1908,7 +1908,7 @@ cmdDomainSnapshotRevert(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: if (snapshot) virDomainSnapshotFree(snapshot); if (dom) @@ -1998,7 +1998,7 @@ cmdSnapshotDelete(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: if (snapshot) virDomainSnapshotFree(snapshot); if (dom) diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index 9bca421b65..55bf6f0115 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -379,7 +379,7 @@ cmdVolCreate(vshControl *ctl, const vshCmd *cmd) vshError(ctl, _("Failed to create vol from %s"), from); } -cleanup: + cleanup: VIR_FREE(buffer); virStoragePoolFree(pool); return ret; @@ -463,7 +463,7 @@ cmdVolCreateFrom(vshControl *ctl, const vshCmd *cmd) } ret = true; -cleanup: + cleanup: VIR_FREE(buffer); if (pool) virStoragePoolFree(pool); @@ -496,7 +496,7 @@ vshMakeCloneXML(const char *origxml, const char *newname) xmlNodeSetContent(obj->nodesetval->nodeTab[0], (const xmlChar *)newname); xmlDocDumpMemory(doc, &newxml, &size); -cleanup: + cleanup: xmlXPathFreeObject(obj); xmlXPathFreeContext(ctxt); xmlFreeDoc(doc); @@ -587,7 +587,7 @@ cmdVolClone(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: VIR_FREE(origxml); xmlFree(newxml); if (origvol) @@ -708,7 +708,7 @@ cmdVolUpload(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: if (vol) virStorageVolFree(vol); if (st) @@ -822,7 +822,7 @@ cmdVolDownload(vshControl *ctl, const vshCmd *cmd) ret = true; -cleanup: + cleanup: VIR_FORCE_CLOSE(fd); if (!ret && created) unlink(file); @@ -952,7 +952,7 @@ cmdVolWipe(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, _("Vol %s wiped\n"), name); ret = true; -out: + out: virStorageVolFree(vol); return ret; } @@ -1131,7 +1131,7 @@ cmdVolResize(vshControl *ctl, const vshCmd *cmd) ret = false; } -cleanup: + cleanup: virStorageVolFree(vol); return ret; } @@ -1251,7 +1251,7 @@ vshStorageVolListCollect(vshControl *ctl, vshError(ctl, "%s", _("Failed to list volumes")); goto cleanup; -fallback: + fallback: /* fall back to old method (0.10.1 and older) */ vshResetLibvirtError(); @@ -1286,7 +1286,7 @@ fallback: /* truncate the list for not found vols */ deleted = nvols - list->nvols; -finished: + finished: /* sort the list */ if (list->vols && list->nvols) qsort(list->vols, list->nvols, sizeof(*list->vols), vshStorageVolSorter); @@ -1296,7 +1296,7 @@ finished: success = true; -cleanup: + cleanup: if (nvols > 0) for (i = 0; i < nvols; i++) VIR_FREE(names[i]); @@ -1529,7 +1529,7 @@ cmdVolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) /* Cleanup and return */ ret = true; -cleanup: + cleanup: /* Safely free the memory allocated in this function */ if (list && list->nvols) { diff --git a/tools/virsh.c b/tools/virsh.c index 02835d9cec..f2e4c4a47d 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -291,7 +291,7 @@ vshReportError(vshControl *ctl) vshError(ctl, "%s", last_error->message); -out: + out: vshResetLibvirtError(); } @@ -686,7 +686,7 @@ vshTreePrintInternal(vshControl *ctl, if (!root) virBufferTrim(indent, NULL, 2); ret = 0; -cleanup: + cleanup: return ret; } @@ -799,7 +799,7 @@ vshEditFile(vshControl *ctl, const char *filename) } ret = 0; -cleanup: + cleanup: virCommandFree(cmd); return ret; } @@ -1162,7 +1162,7 @@ vshCmddefGetOption(vshControl *ctl, const vshCmdDef *cmd, const char *name, vshError(ctl, _("command '%s' doesn't support option --%s"), cmd->name, name); } -cleanup: + cleanup: VIR_FREE(alias); return ret; } @@ -1995,7 +1995,7 @@ vshCommandParse(vshControl *ctl, vshCommandParser *parser) data_only = true; continue; } else { -get_data: + get_data: /* Special case 'help' to ignore spurious data */ if (!(opt = vshCmddefGetData(cmd, &opts_need_arg, &opts_seen)) && @@ -2814,7 +2814,7 @@ vshOutputLogFile(vshControl *ctl, int log_level, const char *msg_format, VIR_FREE(str); return; -error: + error: vshCloseLogFile(ctl); vshError(ctl, "%s", _("failed to write the log file")); virBufferFreeAndReset(&buf); diff --git a/tools/virt-login-shell.c b/tools/virt-login-shell.c index abe7eebdf7..be15a32c91 100644 --- a/tools/virt-login-shell.c +++ b/tools/virt-login-shell.c @@ -94,7 +94,7 @@ static int virLoginShellAllowedUser(virConfPtr conf, virReportSystemError(EPERM, _("%s not matched against 'allowed_users' in %s"), name, conf_file); -cleanup: + cleanup: VIR_FREE(gname); return ret; } @@ -130,7 +130,7 @@ static char **virLoginShellGetShellArgv(virConfPtr conf) } } return shargv; -error: + error: virStringFreeList(shargv); return NULL; } @@ -338,7 +338,7 @@ main(int argc, char **argv) /* At this point, the parent is now waiting for the child to exit, * but as that may take a long time, we release resources now. */ -cleanup: + cleanup: if (nfdlist > 0) for (i = 0; i < nfdlist; i++) VIR_FORCE_CLOSE(fdlist[i]); diff --git a/tools/wireshark/src/packet-libvirt.c b/tools/wireshark/src/packet-libvirt.c index d64ecce404..07098bf24a 100644 --- a/tools/wireshark/src/packet-libvirt.c +++ b/tools/wireshark/src/packet-libvirt.c @@ -344,7 +344,7 @@ dissect_libvirt_payload(tvbuff_t *tvb, proto_tree *tree, } return; -unknown: + unknown: dbg("Cannot determine payload: Prog=%u, Proc=%u, Type=%u, Status=%u", prog, proc, type, status); proto_tree_add_item(tree, hf_libvirt_unknown, tvb, VIR_HEADER_LEN, -1, ENC_NA); }