mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 19:11:16 +00:00
maint: add more free-like functions to the list and deal with fallout
* cfg.mk (useless_free_options): Add many vir*Free* function names, and then remove the useless if-before-free tests exposed by running make syntax-check. * src/conf/interface_conf.c (virInterfaceDefFree): Remove useless "if". (virInterfaceAssignDef): Likewise. * src/conf/network_conf.c (virNetworkAssignDef): Likewise. * src/conf/storage_conf.c (virStoragePoolObjAssignDef): Likewise. * src/node_device/node_device_hal.c (dev_create): Likewise. * src/security/virt-aa-helper.c (vahDeinit): Likewise. * src/test/test_driver.c (testNodeDeviceCreateXML): Likewise. * src/util/conf.c (virConfSetValue): Likewise.
This commit is contained in:
parent
933522a341
commit
a986892e61
155
cfg.mk
155
cfg.mk
@ -65,14 +65,163 @@ local-checks-to-skip = \
|
||||
sc_useless_cpp_parens
|
||||
|
||||
useless_free_options = \
|
||||
--name=sexpr_free \
|
||||
--name=virCgroupFree \
|
||||
--name=VIR_FREE \
|
||||
--name=sexpr_free \
|
||||
--name=virCPUDefFree \
|
||||
--name=virCapabilitiesFree \
|
||||
--name=virCapabilitiesFreeGuest \
|
||||
--name=virCapabilitiesFreeGuestDomain \
|
||||
--name=virCapabilitiesFreeGuestFeature \
|
||||
--name=virCapabilitiesFreeGuestMachine \
|
||||
--name=virCapabilitiesFreeHostNUMACell \
|
||||
--name=virCapabilitiesFreeMachines \
|
||||
--name=virCgroupFree \
|
||||
--name=virConfFreeList \
|
||||
--name=virConfFreeValue \
|
||||
--name=virDomainChrDefFree \
|
||||
--name=virDomainControllerDefFree \
|
||||
--name=virDomainDefFree \
|
||||
--name=virDomainDeviceDefFree \
|
||||
--name=virDomainDiskDefFree \
|
||||
--name=virDomainEventCallbackListFree \
|
||||
--name=virDomainEventFree \
|
||||
--name=virDomainEventQueueFree \
|
||||
--name=virDomainFSDefFree \
|
||||
--name=virDomainGraphicsDefFree \
|
||||
--name=virDomainHostdevDefFree \
|
||||
--name=virDomainInputDefFree \
|
||||
--name=virDomainNetDefFree \
|
||||
--name=virDomainObjFree \
|
||||
--name=virDomainSnapshotDefFree \
|
||||
--name=virDomainSnapshotObjFree \
|
||||
--name=virDomainSoundDefFree \
|
||||
--name=virDomainVideoDefFree \
|
||||
--name=virDomainWatchdogDefFree \
|
||||
--name=virInterfaceDefFree \
|
||||
--name=virInterfaceIpDefFree \
|
||||
--name=virInterfaceObjFree \
|
||||
--name=virInterfaceProtocolDefFree \
|
||||
--name=virJSONValueFree \
|
||||
--name=virLastErrFreeData \
|
||||
--name=virNWFilterDefFree \
|
||||
--name=virNWFilterEntryFree \
|
||||
--name=virNWFilterHashTableFree \
|
||||
--name=virNWFilterIPAddrLearnReqFree \
|
||||
--name=virNWFilterIncludeDefFree \
|
||||
--name=virNWFilterPoolObjFree \
|
||||
--name=virNWFilterRuleDefFree \
|
||||
--name=virNWFilterRuleInstFree \
|
||||
--name=virNetworkDefFree \
|
||||
--name=virNetworkObjFree \
|
||||
--name=virNodeDeviceDefFree \
|
||||
--name=virNodeDeviceObjFree \
|
||||
--name=virSecretDefFree \
|
||||
--name=virStorageEncryptionFree \
|
||||
--name=virStorageEncryptionSecretFree \
|
||||
--name=virStoragePoolDefFree \
|
||||
--name=virStoragePoolObjFree \
|
||||
--name=virStoragePoolSourceFree \
|
||||
--name=virStorageVolDefFree \
|
||||
--name=xmlFree \
|
||||
--name=xmlXPathFreeContext \
|
||||
--name=virDomainDefFree \
|
||||
--name=xmlXPathFreeObject
|
||||
|
||||
# The following template was generated by this command:
|
||||
# make ID && aid free|grep '^vi'|sed 's/ .*//;s/^/# /'
|
||||
# N virBufferFreeAndReset
|
||||
# y virCPUDefFree
|
||||
# y virCapabilitiesFree
|
||||
# y virCapabilitiesFreeGuest
|
||||
# y virCapabilitiesFreeGuestDomain
|
||||
# y virCapabilitiesFreeGuestFeature
|
||||
# y virCapabilitiesFreeGuestMachine
|
||||
# y virCapabilitiesFreeHostNUMACell
|
||||
# y virCapabilitiesFreeMachines
|
||||
# N virCapabilitiesFreeNUMAInfo FIXME
|
||||
# y virCgroupFree
|
||||
# N virConfFree (diagnoses the "error")
|
||||
# y virConfFreeList
|
||||
# y virConfFreeValue
|
||||
# y virDomainChrDefFree
|
||||
# y virDomainControllerDefFree
|
||||
# y virDomainDefFree
|
||||
# y virDomainDeviceDefFree
|
||||
# y virDomainDiskDefFree
|
||||
# y virDomainEventCallbackListFree
|
||||
# y virDomainEventFree
|
||||
# y virDomainEventQueueFree
|
||||
# y virDomainFSDefFree
|
||||
# n virDomainFree
|
||||
# n virDomainFreeName (can't fix -- returns int)
|
||||
# y virDomainGraphicsDefFree
|
||||
# y virDomainHostdevDefFree
|
||||
# y virDomainInputDefFree
|
||||
# y virDomainNetDefFree
|
||||
# y virDomainObjFree
|
||||
# y virDomainSnapshotDefFree
|
||||
# n virDomainSnapshotFree (returns int)
|
||||
# n virDomainSnapshotFreeName (returns int)
|
||||
# y virDomainSnapshotObjFree
|
||||
# y virDomainSoundDefFree
|
||||
# y virDomainVideoDefFree
|
||||
# y virDomainWatchdogDefFree
|
||||
# n virDrvNodeGetCellsFreeMemory (returns int)
|
||||
# n virDrvNodeGetFreeMemory (returns long long)
|
||||
# n virFree (dereferences param)
|
||||
# n virFreeError
|
||||
# n virHashFree (takes 2 args)
|
||||
# y virInterfaceDefFree
|
||||
# n virInterfaceFree (returns int)
|
||||
# n virInterfaceFreeName
|
||||
# y virInterfaceIpDefFree
|
||||
# y virInterfaceObjFree
|
||||
# n virInterfaceObjListFree
|
||||
# y virInterfaceProtocolDefFree
|
||||
# y virJSONValueFree
|
||||
# y virLastErrFreeData
|
||||
# y virNWFilterDefFree
|
||||
# y virNWFilterEntryFree
|
||||
# n virNWFilterFree (returns int)
|
||||
# y virNWFilterHashTableFree
|
||||
# y virNWFilterIPAddrLearnReqFree
|
||||
# y virNWFilterIncludeDefFree
|
||||
# n virNWFilterPoolFreeName (returns int)
|
||||
# y virNWFilterPoolObjFree
|
||||
# n virNWFilterPoolObjListFree FIXME
|
||||
# y virNWFilterRuleDefFree
|
||||
# n virNWFilterRuleFreeInstanceData (typedef)
|
||||
# y virNWFilterRuleInstFree
|
||||
# y virNetworkDefFree
|
||||
# n virNetworkFree (returns int)
|
||||
# n virNetworkFreeName (returns int)
|
||||
# y virNetworkObjFree
|
||||
# n virNetworkObjListFree FIXME
|
||||
# n virNodeDevCapsDefFree FIXME
|
||||
# y virNodeDeviceDefFree
|
||||
# n virNodeDeviceFree (returns int)
|
||||
# y virNodeDeviceObjFree
|
||||
# n virNodeDeviceObjListFree FIXME
|
||||
# n virNodeGetCellsFreeMemory (returns int)
|
||||
# n virNodeGetFreeMemory (returns non-void)
|
||||
# y virSecretDefFree
|
||||
# n virSecretFree (returns non-void)
|
||||
# n virSecretFreeName (2 args)
|
||||
# n virSecurityLabelDefFree FIXME
|
||||
# n virStorageBackendDiskMakeFreeExtent (returns non-void)
|
||||
# y virStorageEncryptionFree
|
||||
# y virStorageEncryptionSecretFree
|
||||
# n virStorageFreeType (enum)
|
||||
# y virStoragePoolDefFree
|
||||
# n virStoragePoolFree (returns non-void)
|
||||
# n virStoragePoolFreeName (returns non-void)
|
||||
# y virStoragePoolObjFree
|
||||
# n virStoragePoolObjListFree FIXME
|
||||
# y virStoragePoolSourceFree
|
||||
# y virStorageVolDefFree
|
||||
# n virStorageVolFree (returns non-void)
|
||||
# n virStorageVolFreeName (returns non-void)
|
||||
# n virStreamFree
|
||||
|
||||
# Avoid uses of write(2). Either switch to streams (fwrite), or use
|
||||
# the safewrite wrapper.
|
||||
sc_avoid_write:
|
||||
|
@ -85,20 +85,18 @@ void virInterfaceDefFree(virInterfaceDefPtr def)
|
||||
switch (def->type) {
|
||||
case VIR_INTERFACE_TYPE_BRIDGE:
|
||||
for (i = 0;i < def->data.bridge.nbItf;i++) {
|
||||
if (def->data.bridge.itf[i] != NULL)
|
||||
virInterfaceDefFree(def->data.bridge.itf[i]);
|
||||
else
|
||||
if (def->data.bridge.itf[i] == NULL)
|
||||
break; /* to cope with half parsed data on errors */
|
||||
virInterfaceDefFree(def->data.bridge.itf[i]);
|
||||
}
|
||||
VIR_FREE(def->data.bridge.itf);
|
||||
break;
|
||||
case VIR_INTERFACE_TYPE_BOND:
|
||||
VIR_FREE(def->data.bond.target);
|
||||
for (i = 0;i < def->data.bond.nbItf;i++) {
|
||||
if (def->data.bond.itf[i] != NULL)
|
||||
virInterfaceDefFree(def->data.bond.itf[i]);
|
||||
else
|
||||
if (def->data.bond.itf[i] == NULL)
|
||||
break; /* to cope with half parsed data on errors */
|
||||
virInterfaceDefFree(def->data.bond.itf[i]);
|
||||
}
|
||||
VIR_FREE(def->data.bond.itf);
|
||||
break;
|
||||
@ -1227,7 +1225,6 @@ virInterfaceObjPtr virInterfaceAssignDef(virInterfaceObjListPtr interfaces,
|
||||
virInterfaceObjPtr iface;
|
||||
|
||||
if ((iface = virInterfaceFindByName(interfaces, def->name))) {
|
||||
if (iface->def)
|
||||
virInterfaceDefFree(iface->def);
|
||||
iface->def = def;
|
||||
|
||||
|
@ -157,7 +157,6 @@ virNetworkObjPtr virNetworkAssignDef(virNetworkObjListPtr nets,
|
||||
virNetworkDefFree(network->def);
|
||||
network->def = def;
|
||||
} else {
|
||||
if (network->newDef)
|
||||
virNetworkDefFree(network->newDef);
|
||||
network->newDef = def;
|
||||
}
|
||||
|
@ -1332,7 +1332,6 @@ virStoragePoolObjAssignDef(virStoragePoolObjListPtr pools,
|
||||
virStoragePoolDefFree(pool->def);
|
||||
pool->def = def;
|
||||
} else {
|
||||
if (pool->newDef)
|
||||
virStoragePoolDefFree(pool->newDef);
|
||||
pool->newDef = def;
|
||||
}
|
||||
|
@ -486,7 +486,6 @@ static void dev_create(const char *udi)
|
||||
DEBUG("FAILED TO ADD dev %s", name);
|
||||
cleanup:
|
||||
VIR_FREE(privData);
|
||||
if (def)
|
||||
virNodeDeviceDefFree(def);
|
||||
nodeDeviceUnlock(driverState);
|
||||
}
|
||||
|
@ -63,7 +63,6 @@ vahDeinit(vahControl * ctl)
|
||||
return -1;
|
||||
|
||||
VIR_FREE(ctl->def);
|
||||
if (ctl->caps)
|
||||
virCapabilitiesFree(ctl->caps);
|
||||
VIR_FREE(ctl->files);
|
||||
VIR_FREE(ctl->hvm);
|
||||
|
@ -4983,7 +4983,6 @@ testNodeDeviceCreateXML(virConnectPtr conn,
|
||||
def = NULL;
|
||||
cleanup:
|
||||
testDriverUnlock(driver);
|
||||
if (def)
|
||||
virNodeDeviceDefFree(def);
|
||||
VIR_FREE(wwnn);
|
||||
VIR_FREE(wwpn);
|
||||
|
@ -902,9 +902,7 @@ virConfSetValue (virConfPtr conf,
|
||||
conf->entries = cur;
|
||||
}
|
||||
} else {
|
||||
if (cur->value) {
|
||||
virConfFreeValue(cur->value);
|
||||
}
|
||||
cur->value = value;
|
||||
}
|
||||
return (0);
|
||||
|
Loading…
Reference in New Issue
Block a user