Both accept a NULL value gracefully and virStringFreeList does not zero the pointer afterwards, so a straight replace is safe. Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx> --- src/bhyve/bhyve_command.c | 2 +- src/bhyve/bhyve_parse_command.c | 10 +++++----- src/conf/domain_capabilities.c | 2 +- src/conf/node_device_conf.c | 2 +- src/cpu/cpu_arm.c | 2 +- src/cpu/cpu_ppc64.c | 2 +- src/libxl/libxl_conf.c | 6 +++--- src/libxl/xen_common.c | 12 ++++++------ src/libxl/xen_xl.c | 12 ++++++------ src/libxl/xen_xm.c | 2 +- src/lxc/lxc_container.c | 2 +- src/lxc/lxc_native.c | 20 ++++++++++---------- src/qemu/qemu_agent.c | 4 ++-- src/qemu/qemu_capabilities.c | 8 ++++---- src/qemu/qemu_conf.c | 6 +++--- src/qemu/qemu_domain.c | 8 ++++---- src/qemu/qemu_driver.c | 4 ++-- src/qemu/qemu_migration_params.c | 2 +- src/qemu/qemu_monitor_json.c | 14 +++++++------- src/qemu/qemu_process.c | 2 +- src/remote/remote_daemon_dispatch.c | 2 +- src/remote/remote_driver.c | 2 +- src/storage/storage_backend_rbd.c | 2 +- src/storage/storage_backend_sheepdog.c | 2 +- src/storage/storage_backend_zfs.c | 2 +- src/util/vircgroup.c | 4 ++-- src/util/vircgroupv2.c | 2 +- src/util/virconf.c | 2 +- src/util/virfile.c | 2 +- src/util/virfirmware.c | 4 ++-- src/util/virlog.c | 8 ++++---- src/util/virmacmap.c | 2 +- src/util/virresctrl.c | 14 +++++++------- src/util/virstring.c | 4 ++-- src/util/viruri.c | 2 +- src/vbox/vbox_common.c | 10 +++++----- src/vbox/vbox_snapshot_conf.c | 18 +++++++++--------- src/vbox/vbox_tmpl.c | 2 +- src/vz/vz_sdk.c | 2 +- tests/qemumonitorjsontest.c | 12 ++++++------ tests/qemuxml2argvtest.c | 2 +- tests/vboxsnapshotxmltest.c | 2 +- tests/virconftest.c | 2 +- tests/virfiletest.c | 2 +- tests/virstringtest.c | 8 ++++---- tools/virsh-checkpoint.c | 2 +- tools/virsh-domain.c | 12 ++++++------ tools/virsh-host.c | 10 +++++----- tools/virsh-nodedev.c | 6 +++--- tools/virsh-pool.c | 4 ++-- tools/virsh-snapshot.c | 4 ++-- tools/virt-login-shell-helper.c | 6 +++--- tools/vsh.c | 12 ++++++------ 53 files changed, 146 insertions(+), 146 deletions(-) diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index 22d0b24ec4..86e6640359 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -666,7 +666,7 @@ virAppendBootloaderArgs(virCommandPtr cmd, virDomainDefPtr def) /* XXX: Handle quoted? */ blargs = virStringSplit(def->os.bootloaderArgs, " ", 0); virCommandAddArgSet(cmd, (const char * const *)blargs); - virStringListFree(blargs); + g_strfreev(blargs); } static virCommandPtr diff --git a/src/bhyve/bhyve_parse_command.c b/src/bhyve/bhyve_parse_command.c index 76423730d9..b2d2280872 100644 --- a/src/bhyve/bhyve_parse_command.c +++ b/src/bhyve/bhyve_parse_command.c @@ -246,7 +246,7 @@ bhyveCommandLineToArgv(const char *nativeConfig, } else { /* To prevent a use-after-free here, only free the argument list * when it is definitely not going to be used */ - virStringListFree(arglist); + g_strfreev(arglist); } } @@ -254,13 +254,13 @@ bhyveCommandLineToArgv(const char *nativeConfig, if (!(*bhyve_argv = _bhyve_argv)) goto error; - virStringListFree(lines); + g_strfreev(lines); return 0; error: VIR_FREE(_loader_argv); VIR_FREE(_bhyve_argv); - virStringListFree(lines); + g_strfreev(lines); return -1; } @@ -884,8 +884,8 @@ bhyveParseCommandLineString(const char* nativeConfig, } cleanup: - virStringListFree(loader_argv); - virStringListFree(bhyve_argv); + g_strfreev(loader_argv); + g_strfreev(bhyve_argv); return def; error: virDomainDefFree(def); diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index 4b867dd997..d61108e125 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -114,7 +114,7 @@ virDomainCapsCPUModelsDispose(void *obj) for (i = 0; i < cpuModels->nmodels; i++) { VIR_FREE(cpuModels->models[i].name); - virStringListFree(cpuModels->models[i].blockers); + g_strfreev(cpuModels->models[i].blockers); } VIR_FREE(cpuModels->models); diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 2f63772917..79f3f67a1a 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -112,7 +112,7 @@ virNodeDeviceDefFree(virNodeDeviceDefPtr def) VIR_FREE(def->sysfs_path); VIR_FREE(def->parent_sysfs_path); VIR_FREE(def->devnode); - virStringListFree(def->devlinks); + g_strfreev(def->devlinks); caps = def->caps; while (caps) { diff --git a/src/cpu/cpu_arm.c b/src/cpu/cpu_arm.c index addeb4100e..374a4d6f6c 100644 --- a/src/cpu/cpu_arm.c +++ b/src/cpu/cpu_arm.c @@ -124,7 +124,7 @@ virCPUarmDataClear(virCPUarmData *data) if (!data) return; - virStringListFree(data->features); + g_strfreev(data->features); } static void diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 6b3590ab6a..5b34c00a18 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -801,7 +801,7 @@ virCPUppc64DriverGetModels(char ***models) error: if (models) { - virStringListFree(*models); + g_strfreev(*models); *models = NULL; } goto cleanup; diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index 8e63d40376..7c2c015015 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -1922,7 +1922,7 @@ libxlDriverGetDom0MaxmemConf(libxlDriverConfigPtr cfg, goto cleanup; } } - virStringListFree(mem_tokens); + g_strfreev(mem_tokens); mem_tokens = NULL; } @@ -1938,8 +1938,8 @@ libxlDriverGetDom0MaxmemConf(libxlDriverConfigPtr cfg, ret = 0; cleanup: - virStringListFree(cmd_tokens); - virStringListFree(mem_tokens); + g_strfreev(cmd_tokens); + g_strfreev(mem_tokens); return ret; } diff --git a/src/libxl/xen_common.c b/src/libxl/xen_common.c index 475c64f944..75fe7e0644 100644 --- a/src/libxl/xen_common.c +++ b/src/libxl/xen_common.c @@ -1061,20 +1061,20 @@ xenParseVifBridge(virDomainNetDefPtr net, char *bridge) nvlans++; if (VIR_ALLOC_N(net->vlan.tag, nvlans) < 0) { - virStringListFree(vlanstr_list); + g_strfreev(vlanstr_list); return -1; } for (i = 1; i <= nvlans; i++) { if (virStrToLong_ui(vlanstr_list[i], NULL, 10, &tag) < 0) { - virStringListFree(vlanstr_list); + g_strfreev(vlanstr_list); return -1; } net->vlan.tag[i - 1] = tag; } net->vlan.nTags = nvlans; net->vlan.trunk = true; - virStringListFree(vlanstr_list); + g_strfreev(vlanstr_list); if (VIR_ALLOC(net->virtPortProfile) < 0) return -1; @@ -1270,11 +1270,11 @@ xenParseVif(char *entry, const char *vif_typename) for (i = 0; ip_list[i]; i++) { if (virDomainNetAppendIPAddress(net, ip_list[i], 0, 0) < 0) { - virStringListFree(ip_list); + g_strfreev(ip_list); goto cleanup; } } - virStringListFree(ip_list); + g_strfreev(ip_list); } if (script && script[0]) @@ -1679,7 +1679,7 @@ xenMakeIPList(virNetDevIPInfoPtr guestIP) ret = virStringListJoin((const char**)address_array, " "); cleanup: - virStringListFree(address_array); + g_strfreev(address_array); return ret; } diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c index f9dc18ab18..432635cef2 100644 --- a/src/libxl/xen_xl.c +++ b/src/libxl/xen_xl.c @@ -318,15 +318,15 @@ xenParseXLCPUID(virConfPtr conf, virDomainDefPtr def) policy) < 0) goto cleanup; - virStringListFree(name_and_value); + g_strfreev(name_and_value); name_and_value = NULL; } ret = 0; cleanup: - virStringListFree(name_and_value); - virStringListFree(cpuid_pairs); + g_strfreev(name_and_value); + g_strfreev(cpuid_pairs); return ret; } @@ -528,7 +528,7 @@ xenParseXLVnuma(virConfPtr conf, VIR_FREE(tmp); tmp = g_strdup(vtoken); - virStringListFree(token); + g_strfreev(token); if (!(token = virStringSplitCount(tmp, ",", 0, &ndistances))) goto cleanup; @@ -590,7 +590,7 @@ xenParseXLVnuma(virConfPtr conf, cleanup: if (ret) VIR_FREE(cpu); - virStringListFree(token); + g_strfreev(token); VIR_FREE(tmp); return ret; @@ -1402,7 +1402,7 @@ xenFormatXLCPUID(virConfPtr conf, virDomainDefPtr def) ret = 0; cleanup: - virStringListFree(cpuid_pairs); + g_strfreev(cpuid_pairs); VIR_FREE(cpuid_string); return ret; } diff --git a/src/libxl/xen_xm.c b/src/libxl/xen_xm.c index 81b64a2fb4..edf86abc64 100644 --- a/src/libxl/xen_xm.c +++ b/src/libxl/xen_xm.c @@ -281,7 +281,7 @@ xenParseXMDiskList(virConfPtr conf, virDomainDefPtr def) ret = 0; cleanup: - virStringListFree(disks); + g_strfreev(disks); return ret; } diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 24a3b6d626..6e98f133a9 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -553,7 +553,7 @@ static int lxcContainerUnmountSubtree(const char *prefix, ret = 0; cleanup: - virStringListFree(mounts); + g_strfreev(mounts); return ret; } diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c index cc545f5fda..58b9db8f08 100644 --- a/src/lxc/lxc_native.c +++ b/src/lxc/lxc_native.c @@ -136,12 +136,12 @@ static char ** lxcStringSplit(const char *string) result[ntokens - 2] = g_strdup(parts[i]); } - virStringListFree(parts); + g_strfreev(parts); return result; error: - virStringListFree(parts); - virStringListFree(result); + g_strfreev(parts); + g_strfreev(result); return NULL; } @@ -166,13 +166,13 @@ lxcParseFstabLine(char *fstabLine) fstab->type = g_strdup(parts[2]); fstab->options = g_strdup(parts[3]); - virStringListFree(parts); + g_strfreev(parts); return fstab; error: lxcFstabFree(fstab); - virStringListFree(parts); + g_strfreev(parts); return NULL; } @@ -312,7 +312,7 @@ lxcAddFstabLine(virDomainDefPtr def, lxcFstabPtr fstab) ret = 1; cleanup: - virStringListFree(options); + g_strfreev(options); return ret; } @@ -575,11 +575,11 @@ lxcNetworkParseDataIPs(const char *name, virReportError(VIR_ERR_INVALID_ARG, _("Invalid CIDR address: '%s'"), value->str); - virStringListFree(ipparts); + g_strfreev(ipparts); return -1; } - virStringListFree(ipparts); + g_strfreev(ipparts); if (VIR_APPEND_ELEMENT(parseData->ips, parseData->nips, ip) < 0) return -1; @@ -1070,7 +1070,7 @@ lxcBlkioDeviceWalkCallback(const char *name, virConfValuePtr value, void *data) ret = 0; cleanup: - virStringListFree(parts); + g_strfreev(parts); return ret; } @@ -1114,7 +1114,7 @@ lxcSetCapDrop(virDomainDefPtr def, virConfPtr properties) def->features[VIR_DOMAIN_FEATURE_CAPABILITIES] = VIR_DOMAIN_CAPABILITIES_POLICY_ALLOW; - virStringListFree(toDrop); + g_strfreev(toDrop); } virDomainDefPtr diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index af8df49daa..22efd2d42a 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -2165,7 +2165,7 @@ qemuAgentGetInterfaces(qemuAgentPtr agent, } /* Has to be freed for each interface. */ - virStringListFree(ifname); + g_strfreev(ifname); /* as well as IP address which - moreover - * can be presented multiple times */ @@ -2251,7 +2251,7 @@ qemuAgentGetInterfaces(qemuAgentPtr agent, virDomainInterfaceFree(ifaces_ret[i]); } VIR_FREE(ifaces_ret); - virStringListFree(ifname); + g_strfreev(ifname); goto cleanup; } diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 1a2cb874c0..589f2eda58 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3166,7 +3166,7 @@ virQEMUCapsGetCPUFeatures(virQEMUCapsPtr qemuCaps, else ret = 0; - virStringListFree(list); + g_strfreev(list); return ret; } @@ -3222,7 +3222,7 @@ virQEMUCapsProbeQMPTPM(virQEMUCapsPtr qemuCaps, virQEMUCapsTPMModelsToCaps[i].caps); } } - virStringListFree(entries); + g_strfreev(entries); if ((nentries = qemuMonitorGetTPMTypes(mon, &entries)) < 0) return -1; @@ -3235,7 +3235,7 @@ virQEMUCapsProbeQMPTPM(virQEMUCapsPtr qemuCaps, virQEMUCapsSet(qemuCaps, virQEMUCapsTPMTypesToCaps[i].caps); } } - virStringListFree(entries); + g_strfreev(entries); return 0; } @@ -3324,7 +3324,7 @@ virQEMUCapsProbeQMPCommandLine(virQEMUCapsPtr qemuCaps, break; } } - virStringListFree(values); + g_strfreev(values); } return 0; diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 4762f2a88a..d7a30b35e5 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -300,7 +300,7 @@ static void virQEMUDriverConfigDispose(void *obj) virBitmapFree(cfg->namespaces); - virStringListFree(cfg->cgroupDeviceACL); + g_strfreev(cfg->cgroupDeviceACL); VIR_FREE(cfg->uri); VIR_FREE(cfg->configBaseDir); @@ -365,7 +365,7 @@ static void virQEMUDriverConfigDispose(void *obj) VIR_FREE(cfg->snapshotImageFormat); VIR_FREE(cfg->autoDumpPath); - virStringListFree(cfg->securityDriverNames); + g_strfreev(cfg->securityDriverNames); VIR_FREE(cfg->lockManagerName); @@ -374,7 +374,7 @@ static void virQEMUDriverConfigDispose(void *obj) VIR_FREE(cfg->memoryBackingDir); VIR_FREE(cfg->swtpmStorageDir); - virStringListFree(cfg->capabilityfilters); + g_strfreev(cfg->capabilityfilters); } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 2058290870..e5d6430a89 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1687,7 +1687,7 @@ qemuDomainObjPrivateAlloc(void *opaque) void qemuDomainObjPrivateDataClear(qemuDomainObjPrivatePtr priv) { - virStringListFree(priv->qemuDevices); + g_strfreev(priv->qemuDevices); priv->qemuDevices = NULL; virCgroupFree(&priv->cgroup); @@ -1749,7 +1749,7 @@ qemuDomainObjPrivateDataClear(qemuDomainObjPrivatePtr priv) priv->dbusDaemonRunning = false; - virStringListFree(priv->dbusVMStateIds); + g_strfreev(priv->dbusVMStateIds); priv->dbusVMStateIds = NULL; priv->dbusVMState = false; @@ -3129,7 +3129,7 @@ qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, priv->namespaces = NULL; virObjectUnref(priv->monConfig); priv->monConfig = NULL; - virStringListFree(priv->qemuDevices); + g_strfreev(priv->qemuDevices); priv->qemuDevices = NULL; return -1; } @@ -7729,7 +7729,7 @@ qemuDomainUpdateDeviceList(virQEMUDriverPtr driver, if (rc < 0) return -1; - virStringListFree(priv->qemuDevices); + g_strfreev(priv->qemuDevices); priv->qemuDevices = aliases; return 0; } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 0ad6359102..257ba12093 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1401,7 +1401,7 @@ qemuGetSchedInfo(unsigned long long *cpuWait, ret = 0; cleanup: - virStringListFree(lines); + g_strfreev(lines); return ret; } @@ -13479,7 +13479,7 @@ qemuConnectBaselineHypervisorCPU(virConnectPtr conn, cleanup: virCPUDefListFree(cpus); virCPUDefFree(cpu); - virStringListFree(features); + g_strfreev(features); return cpustr; } diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c index fc282960da..04434e9557 100644 --- a/src/qemu/qemu_migration_params.c +++ b/src/qemu/qemu_migration_params.c @@ -1462,7 +1462,7 @@ qemuMigrationCapsCheck(virQEMUDriverPtr driver, cleanup: virBitmapFree(migEvent); virJSONValueFree(json); - virStringListFree(caps); + g_strfreev(caps); return ret; } diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 83f169e31b..9cdf6c0f7f 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -6119,7 +6119,7 @@ int qemuMonitorJSONGetCommands(qemuMonitorPtr mon, cleanup: - virStringListFree(commandlist); + g_strfreev(commandlist); virJSONValueFree(cmd); virJSONValueFree(reply); return ret; @@ -6178,7 +6178,7 @@ int qemuMonitorJSONGetEvents(qemuMonitorPtr mon, eventlist = NULL; cleanup: - virStringListFree(eventlist); + g_strfreev(eventlist); virJSONValueFree(cmd); virJSONValueFree(reply); return ret; @@ -6299,7 +6299,7 @@ qemuMonitorJSONGetCommandLineOptionParameters(qemuMonitorPtr mon, if (!qemuMonitorGetOptions(mon)) qemuMonitorSetOptions(mon, virJSONValueNewArray()); - virStringListFree(paramlist); + g_strfreev(paramlist); virJSONValueFree(cmd); virJSONValueFree(reply); return ret; @@ -6397,7 +6397,7 @@ int qemuMonitorJSONGetObjectTypes(qemuMonitorPtr mon, typelist = NULL; cleanup: - virStringListFree(typelist); + g_strfreev(typelist); virJSONValueFree(cmd); virJSONValueFree(reply); return ret; @@ -6727,7 +6727,7 @@ qemuMonitorJSONParsePropsList(virJSONValuePtr cmd, proplist = NULL; cleanup: - virStringListFree(proplist); + g_strfreev(proplist); return ret; } @@ -6911,7 +6911,7 @@ qemuMonitorJSONGetMigrationCapabilities(qemuMonitorPtr mon, list = NULL; cleanup: - virStringListFree(list); + g_strfreev(list); virJSONValueFree(cmd); virJSONValueFree(reply); return ret; @@ -7351,7 +7351,7 @@ qemuMonitorJSONGetStringArray(qemuMonitorPtr mon, const char *qmpCmd, list = NULL; cleanup: - virStringListFree(list); + g_strfreev(list); virJSONValueFree(cmd); virJSONValueFree(reply); return ret; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index ec6ca14bbd..fc48792b5d 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3732,7 +3732,7 @@ qemuProcessUpdateDevices(virQEMUDriverPtr driver, ret = 0; cleanup: - virStringListFree(old); + g_strfreev(old); return ret; } diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon_dispatch.c index 85ca78a261..c91b5d3293 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -5903,7 +5903,7 @@ remoteDispatchConnectGetCPUModelNames(virNetServerPtr server G_GNUC_UNUSED, cleanup: if (rv < 0) virNetMessageSaveError(rerr); - virStringListFree(models); + g_strfreev(models); return rv; } diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 653c68472a..0331060a2d 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -6529,7 +6529,7 @@ remoteConnectGetCPUModelNames(virConnectPtr conn, rv = ret.ret; cleanup: - virStringListFree(retmodels); + g_strfreev(retmodels); xdr_free((xdrproc_t) xdr_remote_connect_get_cpu_model_names_ret, (char *) &ret); diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c index 08dc5a19dc..cb298419e6 100644 --- a/src/storage/storage_backend_rbd.c +++ b/src/storage/storage_backend_rbd.c @@ -746,7 +746,7 @@ virStorageBackendRBDRefreshPool(virStoragePoolObjPtr pool) ret = 0; cleanup: - virStringListFree(names); + g_strfreev(names); virStorageBackendRBDFreeState(&ptr); return ret; } diff --git a/src/storage/storage_backend_sheepdog.c b/src/storage/storage_backend_sheepdog.c index 853a53115f..f253c0ed57 100644 --- a/src/storage/storage_backend_sheepdog.c +++ b/src/storage/storage_backend_sheepdog.c @@ -167,7 +167,7 @@ virStorageBackendSheepdogRefreshAllVol(virStoragePoolObjPtr pool) return -1; } - virStringListFree(cells); + g_strfreev(cells); cells = NULL; } diff --git a/src/storage/storage_backend_zfs.c b/src/storage/storage_backend_zfs.c index 172245c847..dc692f47ed 100644 --- a/src/storage/storage_backend_zfs.c +++ b/src/storage/storage_backend_zfs.c @@ -253,7 +253,7 @@ virStorageBackendZFSRefreshPool(virStoragePoolObjPtr pool G_GNUC_UNUSED) if (STREQ(lines[i], "")) continue; - virStringListFree(tokens); + g_strfreev(tokens); if (!(tokens = virStringSplitCount(lines[i], "\t", 0, &count))) goto cleanup; diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c index e20cc71c78..08758b5306 100644 --- a/src/util/vircgroup.c +++ b/src/util/vircgroup.c @@ -542,7 +542,7 @@ virCgroupGetValueForBlkDev(const char *str, ret = 0; error: - virStringListFree(lines); + g_strfreev(lines); return ret; } @@ -803,7 +803,7 @@ virCgroupSetPartitionSuffix(const char *path, char **res) ret = 0; cleanup: - virStringListFree(tokens); + g_strfreev(tokens); return ret; } diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index 80f596542c..6b9c5eed70 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -284,7 +284,7 @@ virCgroupV2ParseControllersFile(virCgroupPtr group, tmp++; } - virStringListFree(contList); + g_strfreev(contList); return 0; } diff --git a/src/util/virconf.c b/src/util/virconf.c index 77ca3f9b79..8575dd8849 100644 --- a/src/util/virconf.c +++ b/src/util/virconf.c @@ -932,7 +932,7 @@ int virConfGetValueStringList(virConfPtr conf, if (!cval) return 0; - virStringListFree(*values); + g_strfreev(*values); *values = NULL; switch (cval->type) { diff --git a/src/util/virfile.c b/src/util/virfile.c index af150421e7..6599971ba5 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -2038,7 +2038,7 @@ virFileGetMountSubtreeImpl(const char *mtabpath, cleanup: if (ret < 0) - virStringListFree(mounts); + g_strfreev(mounts); endmntent(procmnt); return ret; } diff --git a/src/util/virfirmware.c b/src/util/virfirmware.c index 9a0610c647..513ec56621 100644 --- a/src/util/virfirmware.c +++ b/src/util/virfirmware.c @@ -84,7 +84,7 @@ virFirmwareParse(const char *str, virFirmwarePtr firmware) ret = 0; cleanup: - virStringListFree(token); + g_strfreev(token); return ret; } @@ -128,6 +128,6 @@ virFirmwareParseList(const char *list, ret = 0; cleanup: - virStringListFree(token); + g_strfreev(token); return ret; } diff --git a/src/util/virlog.c b/src/util/virlog.c index dabfe7e501..7b59f2ae5b 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -1537,7 +1537,7 @@ virLogParseOutput(const char *src) } cleanup: - virStringListFree(tokens); + g_strfreev(tokens); return ret; } @@ -1612,7 +1612,7 @@ virLogParseFilter(const char *src) goto cleanup; cleanup: - virStringListFree(tokens); + g_strfreev(tokens); return ret; } @@ -1672,7 +1672,7 @@ virLogParseOutputs(const char *src, virLogOutputPtr **outputs) *outputs = list; list = NULL; cleanup: - virStringListFree(strings); + g_strfreev(strings); return ret; } @@ -1722,7 +1722,7 @@ virLogParseFilters(const char *src, virLogFilterPtr **filters) *filters = list; list = NULL; cleanup: - virStringListFree(strings); + g_strfreev(strings); return ret; } diff --git a/src/util/virmacmap.c b/src/util/virmacmap.c index 4a57edede8..4b5e24718d 100644 --- a/src/util/virmacmap.c +++ b/src/util/virmacmap.c @@ -55,7 +55,7 @@ virMacMapHashFree(void *payload, const void *name G_GNUC_UNUSED, void *opaque G_GNUC_UNUSED) { - virStringListFree(payload); + g_strfreev(payload); return 0; } diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index 3563fc560d..4266712456 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -216,7 +216,7 @@ virResctrlInfoDispose(void *obj) } if (resctrl->monitor_info) - virStringListFree(resctrl->monitor_info->features); + g_strfreev(resctrl->monitor_info->features); VIR_FREE(resctrl->membw_info); VIR_FREE(resctrl->levels); @@ -230,7 +230,7 @@ virResctrlInfoMonFree(virResctrlInfoMonPtr mon) if (!mon) return; - virStringListFree(mon->features); + g_strfreev(mon->features); VIR_FREE(mon); } @@ -755,7 +755,7 @@ virResctrlGetMonitorInfo(virResctrlInfoPtr resctrl) ret = 0; cleanup: VIR_FREE(featurestr); - virStringListFree(features); + g_strfreev(features); VIR_FREE(info_monitor); return ret; } @@ -1533,7 +1533,7 @@ virResctrlAllocParseMemoryBandwidthLine(virResctrlInfoPtr resctrl, ret = 0; cleanup: - virStringListFree(mbs); + g_strfreev(mbs); return ret; } @@ -1707,7 +1707,7 @@ virResctrlAllocParseCacheLine(virResctrlInfoPtr resctrl, ret = 0; cleanup: - virStringListFree(caches); + g_strfreev(caches); return ret; } @@ -1733,7 +1733,7 @@ virResctrlAllocParse(virResctrlInfoPtr resctrl, ret = 0; cleanup: - virStringListFree(lines); + g_strfreev(lines); return ret; } @@ -2768,7 +2768,7 @@ virResctrlMonitorStatsFree(virResctrlMonitorStatsPtr stat) if (!stat) return; - virStringListFree(stat->features); + g_strfreev(stat->features); VIR_FREE(stat->vals); VIR_FREE(stat); } diff --git a/src/util/virstring.c b/src/util/virstring.c index 9da811b2ec..a63f92d9a7 100644 --- a/src/util/virstring.c +++ b/src/util/virstring.c @@ -282,7 +282,7 @@ void virStringListAutoFree(char ***strings) if (!*strings) return; - virStringListFree(*strings); + g_strfreev(*strings); *strings = NULL; } @@ -985,7 +985,7 @@ virStringSearch(const char *str, cleanup: if (ret < 0) { - virStringListFree(*matches); + g_strfreev(*matches); *matches = NULL; } return ret; diff --git a/src/util/viruri.c b/src/util/viruri.c index 492454a3df..9c74093c4b 100644 --- a/src/util/viruri.c +++ b/src/util/viruri.c @@ -368,7 +368,7 @@ virURIResolveAlias(virConfPtr conf, const char *alias, char **uri) if (aliases && *aliases) { ret = virURIFindAliasMatch(aliases, alias, uri); - virStringListFree(aliases); + g_strfreev(aliases); } else { ret = 0; } diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 15f8eb074a..b5a99867dc 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -5005,7 +5005,7 @@ vboxSnapshotRedefine(virDomainPtr dom, tmp = virStringReplace(newSnapshotPtr->storageController, searchResultTab[it], uuidReplacing); - virStringListFree(searchResultTab); + g_strfreev(searchResultTab); searchResultTab = NULL; VIR_FREE(newSnapshotPtr->storageController); if (!tmp) @@ -5405,9 +5405,9 @@ vboxSnapshotRedefine(virDomainPtr dom, VIR_FREE(currentSnapshotXmlFilePath); VBOX_UTF16_FREE(machineNameUtf16); VBOX_UTF8_FREE(machineName); - virStringListFree(realReadOnlyDisksPath); - virStringListFree(realReadWriteDisksPath); - virStringListFree(searchResultTab); + g_strfreev(realReadOnlyDisksPath); + g_strfreev(realReadWriteDisksPath); + g_strfreev(searchResultTab); virVboxSnapshotConfHardDiskFree(newHardDisk); VIR_FREE(hardDiskToOpen); VIR_FREE(newSnapshotPtr); @@ -7256,7 +7256,7 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot) VBOX_RELEASE(machine); VBOX_UTF16_FREE(settingsFilePathUtf16); VBOX_UTF8_FREE(settingsFilepath); - virStringListFree(searchResultTab); + g_strfreev(searchResultTab); VIR_FREE(snapshotMachineDesc); VBOX_UTF16_FREE(machineNameUtf16); VBOX_UTF8_FREE(machineName); diff --git a/src/vbox/vbox_snapshot_conf.c b/src/vbox/vbox_snapshot_conf.c index 5c3269b825..6b95311328 100644 --- a/src/vbox/vbox_snapshot_conf.c +++ b/src/vbox/vbox_snapshot_conf.c @@ -103,7 +103,7 @@ virVBoxSnapshotConfCreateVBoxSnapshotConfHardDiskPtr(xmlNodePtr diskNode, VIR_FREE(nodes); VIR_FREE(location); VIR_FREE(tmp); - virStringListFree(searchTabResult); + g_strfreev(searchTabResult); if (result < 0) { virVboxSnapshotConfHardDiskFree(hardDisk); hardDisk = NULL; @@ -271,7 +271,7 @@ virVBoxSnapshotConfRetrieveSnapshot(xmlNodePtr snapshotNode, } VIR_FREE(nodes); VIR_FREE(uuid); - virStringListFree(searchTabResult); + g_strfreev(searchTabResult); return snapshot; } @@ -451,8 +451,8 @@ virVBoxSnapshotConfSerializeSnapshot(xmlNodePtr node, xmlUnlinkNode(snapshotsNode); xmlFreeNode(snapshotsNode); } - virStringListFree(firstRegex); - virStringListFree(secondRegex); + g_strfreev(firstRegex); + g_strfreev(secondRegex); VIR_FREE(uuid); VIR_FREE(timeStamp); return result; @@ -730,7 +730,7 @@ virVBoxSnapshotConfLoadVboxFile(const char *filePath, VIR_FREE(currentStateModifiedString); VIR_FREE(currentSnapshotAttribute); - virStringListFree(searchResultTab); + g_strfreev(searchResultTab); if (ret < 0) { virVBoxSnapshotConfMachineFree(machineDescription); machineDescription = NULL; @@ -1211,8 +1211,8 @@ virVBoxSnapshotConfSaveVboxFile(virVBoxSnapshotConfMachinePtr machine, xmlFreeDoc(xml); - virStringListFree(firstRegex); - virStringListFree(secondRegex); + g_strfreev(firstRegex); + g_strfreev(secondRegex); return ret; } @@ -1297,7 +1297,7 @@ virVBoxSnapshotConfGetRWDisksPathsFromLibvirtXML(const char *filePath, xmlFreeDoc(xml); xmlXPathFreeContext(xPathContext); if (result < 0) { - virStringListFree(ret); + g_strfreev(ret); nodeSize = -1; } else { *rwDisksPath = ret; @@ -1358,7 +1358,7 @@ virVBoxSnapshotConfGetRODisksPathsFromLibvirtXML(const char *filePath, xmlFreeDoc(xml); xmlXPathFreeContext(xPathContext); if (result < 0) { - virStringListFree(ret); + g_strfreev(ret); nodeSize = -1; } else { *roDisksPath = ret; diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index a8ffd9f148..d37ffd9a6b 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -1600,7 +1600,7 @@ _vrdeServerGetPorts(vboxDriverPtr data, IVRDEServer *VRDEServer, } cleanup: - virStringListFree(matches); + g_strfreev(matches); VBOX_UTF8_FREE(portUtf8); VBOX_UTF16_FREE(VRDEPortsValue); VBOX_UTF16_FREE(VRDEPortsKey); diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index b5e69b385f..dbbf38ac29 100644 --- a/src/vz/vz_sdk.c +++ b/src/vz/vz_sdk.c @@ -796,7 +796,7 @@ prlsdkGetFSInfo(PRL_HANDLE prldisk, cleanup: VIR_FREE(buf); - virStringListFree(matches); + g_strfreev(matches); return ret; } diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 741e36a491..77e70c1dc4 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -611,7 +611,7 @@ testQemuMonitorJSONGetTPMModels(const void *opaque) ret = 0; cleanup: - virStringListFree(tpmmodels); + g_strfreev(tpmmodels); return ret; } @@ -672,7 +672,7 @@ testQemuMonitorJSONGetCommandLineOptionParameters(const void *opaque) #undef CHECK - virStringListFree(params); + g_strfreev(params); params = NULL; /* present but empty */ @@ -698,7 +698,7 @@ testQemuMonitorJSONGetCommandLineOptionParameters(const void *opaque) goto cleanup; } - virStringListFree(params); + g_strfreev(params); params = NULL; /* no such option */ @@ -727,7 +727,7 @@ testQemuMonitorJSONGetCommandLineOptionParameters(const void *opaque) ret = 0; cleanup: - virStringListFree(params); + g_strfreev(params); return ret; } @@ -1186,7 +1186,7 @@ testQemuMonitorJSONGetDeviceAliases(const void *opaque) } cleanup: - virStringListFree(aliases); + g_strfreev(aliases); return ret; } @@ -2269,7 +2269,7 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationCapabilities(const void *opaque) cleanup: virJSONValueFree(json); - virStringListFree(caps); + g_strfreev(caps); virBitmapFree(bitmap); return ret; } diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index e0e3d0d4a9..3da94f3f2f 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -159,7 +159,7 @@ fakeStorageVolLookupByName(virStoragePoolPtr pool, NULL, NULL); cleanup: - virStringListFree(volinfo); + g_strfreev(volinfo); return ret; fallback: diff --git a/tests/vboxsnapshotxmltest.c b/tests/vboxsnapshotxmltest.c index 054e2a8e0d..7e3f85cc58 100644 --- a/tests/vboxsnapshotxmltest.c +++ b/tests/vboxsnapshotxmltest.c @@ -39,7 +39,7 @@ testFilterXML(char *xml) ret = virBufferContentAndReset(&buf); cleanup: - virStringListFree(xmlLines); + g_strfreev(xmlLines); return ret; } diff --git a/tests/virconftest.c b/tests/virconftest.c index 83077342a9..ab29b5b712 100644 --- a/tests/virconftest.c +++ b/tests/virconftest.c @@ -441,7 +441,7 @@ static int testConfParseStringList(const void *opaque G_GNUC_UNUSED) ret = 0; cleanup: - virStringListFree(str); + g_strfreev(str); return ret; } diff --git a/tests/virfiletest.c b/tests/virfiletest.c index d410bb68e4..1392536b74 100644 --- a/tests/virfiletest.c +++ b/tests/virfiletest.c @@ -88,7 +88,7 @@ static int testFileGetMountSubtree(const void *opaque) data->mounts, data->nmounts); cleanup: - virStringListFree(gotmounts); + g_strfreev(gotmounts); return ret; } #endif /* ! defined HAVE_MNTENT_H && defined HAVE_GETMNTENT_R */ diff --git a/tests/virstringtest.c b/tests/virstringtest.c index bee49e6cb6..8b8d2acced 100644 --- a/tests/virstringtest.c +++ b/tests/virstringtest.c @@ -134,7 +134,7 @@ static int testSplit(const void *args) ret = 0; cleanup: - virStringListFree(got); + g_strfreev(got); return ret; } @@ -192,7 +192,7 @@ static int testAdd(const void *args) ret = 0; cleanup: - virStringListFree(list); + g_strfreev(list); VIR_FREE(got); return ret; } @@ -227,7 +227,7 @@ static int testRemove(const void *args) ret = 0; cleanup: - virStringListFree(list); + g_strfreev(list); return ret; } @@ -331,7 +331,7 @@ testStringSearch(const void *opaque) ret = 0; cleanup: - virStringListFree(matches); + g_strfreev(matches); return ret; } diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c index 821212f86b..411eac7fc8 100644 --- a/tools/virsh-checkpoint.c +++ b/tools/virsh-checkpoint.c @@ -185,7 +185,7 @@ virshParseCheckpointDiskspec(vshControl *ctl, cleanup: if (ret < 0) vshError(ctl, _("unable to parse diskspec: %s"), str); - virStringListFree(array); + g_strfreev(array); return ret; } diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index aaf3b9a6a5..7ab5d3810a 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -887,7 +887,7 @@ virshParseRateStr(vshControl *ctl, ret = 0; cleanup: - virStringListFree(tok); + g_strfreev(tok); return ret; } @@ -4085,14 +4085,14 @@ cmdStartGetFDs(vshControl *ctl, fds[nfds - 1] = fd; } - virStringListFree(fdlist); + g_strfreev(fdlist); *fdsret = fds; *nfdsret = nfds; return 0; error: - virStringListFree(fdlist); + g_strfreev(fdlist); VIR_FREE(fds); return -1; } @@ -5978,7 +5978,7 @@ cmdShutdown(vshControl *ctl, const vshCmd *cmd) ret = true; cleanup: virshDomainFree(dom); - virStringListFree(modes); + g_strfreev(modes); return ret; } @@ -6058,7 +6058,7 @@ cmdReboot(vshControl *ctl, const vshCmd *cmd) ret = true; cleanup: virshDomainFree(dom); - virStringListFree(modes); + g_strfreev(modes); return ret; } @@ -9365,7 +9365,7 @@ virshParseEventStr(const char *event, ret = 0; cleanup: - virStringListFree(tok); + g_strfreev(tok); return ret; } diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 0fd77cbae5..64bfcd0e34 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -1193,7 +1193,7 @@ vshExtractCPUDefXMLs(vshControl *ctl, return cpus; error: - virStringListFree(cpus); + g_strfreev(cpus); goto cleanup; } @@ -1267,7 +1267,7 @@ cmdCPUCompare(vshControl *ctl, const vshCmd *cmd) ret = true; cleanup: - virStringListFree(cpus); + g_strfreev(cpus); return ret; } @@ -1329,7 +1329,7 @@ cmdCPUBaseline(vshControl *ctl, const vshCmd *cmd) } VIR_FREE(result); - virStringListFree(list); + g_strfreev(list); return ret; } @@ -1705,7 +1705,7 @@ cmdHypervisorCPUCompare(vshControl *ctl, ret = true; cleanup: - virStringListFree(cpus); + g_strfreev(cpus); return ret; } @@ -1795,7 +1795,7 @@ cmdHypervisorCPUBaseline(vshControl *ctl, } VIR_FREE(result); - virStringListFree(list); + g_strfreev(list); return ret; } diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index 7f091d7cf8..7b3e13c27d 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -154,7 +154,7 @@ cmdNodeDeviceDestroy(vshControl *ctl, const vshCmd *cmd) ret = true; cleanup: - virStringListFree(arr); + g_strfreev(arr); if (dev) virNodeDeviceFree(dev); return ret; @@ -508,7 +508,7 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) } cleanup: - virStringListFree(caps); + g_strfreev(caps); virshNodeDeviceListFree(list); return ret; } @@ -578,7 +578,7 @@ cmdNodeDeviceDumpXML(vshControl *ctl, const vshCmd *cmd) ret = true; cleanup: - virStringListFree(arr); + g_strfreev(arr); VIR_FREE(xml); if (device) virNodeDeviceFree(device); diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index 622b1396d0..fd43d3bb62 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -1175,7 +1175,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) for (i = 0; i < npoolTypes; i++) { if ((poolType = virStoragePoolTypeFromString(poolTypes[i])) < 0) { vshError(ctl, _("Invalid pool type '%s'"), poolTypes[i]); - virStringListFree(poolTypes); + g_strfreev(poolTypes); return false; } @@ -1226,7 +1226,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) break; } } - virStringListFree(poolTypes); + g_strfreev(poolTypes); } if (!(list = virshStoragePoolListCollect(ctl, flags))) diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 4ac6cb1dcd..7376676df4 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -253,7 +253,7 @@ virshParseSnapshotMemspec(vshControl *ctl, virBufferPtr buf, const char *str) cleanup: if (ret < 0) vshError(ctl, _("unable to parse memspec: %s"), str); - virStringListFree(array); + g_strfreev(array); return ret; } @@ -321,7 +321,7 @@ virshParseSnapshotDiskspec(vshControl *ctl, virBufferPtr buf, const char *str) cleanup: if (ret < 0) vshError(ctl, _("unable to parse diskspec: %s"), str); - virStringListFree(array); + g_strfreev(array); return ret; } diff --git a/tools/virt-login-shell-helper.c b/tools/virt-login-shell-helper.c index 2db349754e..cc6836382a 100644 --- a/tools/virt-login-shell-helper.c +++ b/tools/virt-login-shell-helper.c @@ -84,7 +84,7 @@ static int virLoginShellAllowedUser(virConfPtr conf, name, conf_file); cleanup: VIR_FREE(gname); - virStringListFree(users); + g_strfreev(users); return ret; } @@ -329,7 +329,7 @@ main(int argc, char **argv) if (autoshell) { tmp = virGetUserShell(uid); if (tmp) { - virStringListFree(shargv); + g_strfreev(shargv); shargvlen = 1; if (VIR_ALLOC_N(shargv[0], shargvlen + 1) < 0) { VIR_FREE(tmp); @@ -410,7 +410,7 @@ main(int argc, char **argv) virDomainFree(dom); if (conn) virConnectClose(conn); - virStringListFree(shargv); + g_strfreev(shargv); VIR_FREE(shcmd); VIR_FREE(term); VIR_FREE(name); diff --git a/tools/vsh.c b/tools/vsh.c index b65e99cbd2..ee93c769d7 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -2581,7 +2581,7 @@ vshReadlineCommandGenerator(const char *text) if (STREQLEN(name, text, len)) { if (VIR_REALLOC_N(ret, ret_size + 2) < 0) { - virStringListFree(ret); + g_strfreev(ret); return NULL; } ret[ret_size] = g_strdup(name); @@ -2646,7 +2646,7 @@ vshReadlineOptionsGenerator(const char *text, continue; if (VIR_REALLOC_N(ret, ret_size + 2) < 0) { - virStringListFree(ret); + g_strfreev(ret); return NULL; } @@ -2740,7 +2740,7 @@ vshReadlineParse(const char *text, int state) vshCommandFree(partial); partial = NULL; - virStringListFree(list); + g_strfreev(list); list = NULL; list_index = 0; @@ -2790,7 +2790,7 @@ vshReadlineParse(const char *text, int state) if (completer_list && (vshCompleterFilter(&completer_list, text) < 0 || virStringListMerge(&list, &completer_list) < 0)) { - virStringListFree(completer_list); + g_strfreev(completer_list); goto cleanup; } } @@ -2814,7 +2814,7 @@ vshReadlineParse(const char *text, int state) if (!ret) { vshCommandFree(partial); partial = NULL; - virStringListFree(list); + g_strfreev(list); list = NULL; list_index = 0; } @@ -3404,7 +3404,7 @@ cmdComplete(vshControl *ctl, const vshCmd *cmd) ret = true; cleanup: - virStringListFree(matches); + g_strfreev(matches); return ret; } -- 2.26.2