mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-08 12:41:29 +00:00
lib: Use more of VIR_STEAL_PTR()
We have this very handy macro called VIR_STEAL_PTR() which steals one pointer into the other and sets the other to NULL. The following coccinelle patch was used to create this commit: @ rule1 @ identifier a, b; @@ - b = a; ... - a = NULL; + VIR_STEAL_PTR(b, a); Some places were clean up afterwards to make syntax-check happy (e.g. some curly braces were removed where the body become a one liner). Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
7c700108d6
commit
5772885d28
@ -1757,8 +1757,7 @@ virDomainVirtioSerialAddrSetCreateFromDomain(virDomainDefPtr def)
|
|||||||
addrs) < 0)
|
addrs) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = addrs;
|
VIR_STEAL_PTR(ret, addrs);
|
||||||
addrs = NULL;
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainVirtioSerialAddrSetFree(addrs);
|
virDomainVirtioSerialAddrSetFree(addrs);
|
||||||
return ret;
|
return ret;
|
||||||
@ -2095,8 +2094,7 @@ virDomainUSBAddressHubNew(size_t nports)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
hub->nports = nports;
|
hub->nports = nports;
|
||||||
|
|
||||||
ret = hub;
|
VIR_STEAL_PTR(ret, hub);
|
||||||
hub = NULL;
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainUSBAddressHubFree(hub);
|
virDomainUSBAddressHubFree(hub);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -7900,8 +7900,7 @@ virDomainNetIPParseXML(xmlNodePtr node)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ip;
|
VIR_STEAL_PTR(ret, ip);
|
||||||
ip = NULL;
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(prefixStr);
|
VIR_FREE(prefixStr);
|
||||||
@ -13482,10 +13481,8 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!address) {
|
if (!address)
|
||||||
address = addressCompat;
|
VIR_STEAL_PTR(address, addressCompat);
|
||||||
addressCompat = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET) {
|
if (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET) {
|
||||||
@ -13497,10 +13494,8 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDefPtr def,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!socketPath) {
|
if (!socketPath)
|
||||||
socketPath = socketCompat;
|
VIR_STEAL_PTR(socketPath, socketCompat);
|
||||||
socketCompat = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (address && address[0] &&
|
if (address && address[0] &&
|
||||||
@ -14747,8 +14742,7 @@ virDomainShmemDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
|
|
||||||
ret = def;
|
VIR_STEAL_PTR(ret, def);
|
||||||
def = NULL;
|
|
||||||
cleanup:
|
cleanup:
|
||||||
ctxt->node = save;
|
ctxt->node = save;
|
||||||
VIR_FREE(tmp);
|
VIR_FREE(tmp);
|
||||||
@ -16187,8 +16181,7 @@ virDomainIOMMUDefParseXML(xmlNodePtr node,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = iommu;
|
VIR_STEAL_PTR(ret, iommu);
|
||||||
iommu = NULL;
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
ctxt->node = save;
|
ctxt->node = save;
|
||||||
|
@ -193,8 +193,7 @@ secretXMLParseNode(xmlDocPtr xml, xmlNodePtr root)
|
|||||||
if (virXPathNode("./usage", ctxt) != NULL
|
if (virXPathNode("./usage", ctxt) != NULL
|
||||||
&& virSecretDefParseUsage(ctxt, def) < 0)
|
&& virSecretDefParseUsage(ctxt, def) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
ret = def;
|
VIR_STEAL_PTR(ret, def);
|
||||||
def = NULL;
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(prop);
|
VIR_FREE(prop);
|
||||||
|
@ -587,8 +587,7 @@ virStoragePoolDefParseSourceString(const char *srcSpec,
|
|||||||
node) < 0)
|
node) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = def;
|
VIR_STEAL_PTR(ret, def);
|
||||||
def = NULL;
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virStoragePoolSourceFree(def);
|
virStoragePoolSourceFree(def);
|
||||||
xmlFreeDoc(doc);
|
xmlFreeDoc(doc);
|
||||||
|
@ -602,8 +602,7 @@ virNetworkObjAssignDefLocked(virNetworkObjListPtr nets,
|
|||||||
obj->persistent = !(flags & VIR_NETWORK_OBJ_LIST_ADD_LIVE);
|
obj->persistent = !(flags & VIR_NETWORK_OBJ_LIST_ADD_LIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = obj;
|
VIR_STEAL_PTR(ret, obj);
|
||||||
obj = NULL;
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virNetworkObjEndAPI(&obj);
|
virNetworkObjEndAPI(&obj);
|
||||||
|
@ -394,8 +394,7 @@ virSecretObjListAdd(virSecretObjListPtr secrets,
|
|||||||
virObjectRef(obj);
|
virObjectRef(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = obj;
|
VIR_STEAL_PTR(ret, obj);
|
||||||
obj = NULL;
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virSecretObjEndAPI(&obj);
|
virSecretObjEndAPI(&obj);
|
||||||
|
@ -3046,9 +3046,8 @@ virDomainMigrateVersion3Full(virDomainPtr domain,
|
|||||||
VIR_MIGRATE_AUTO_CONVERGE);
|
VIR_MIGRATE_AUTO_CONVERGE);
|
||||||
|
|
||||||
VIR_DEBUG("Prepare3 %p flags=0x%x", dconn, destflags);
|
VIR_DEBUG("Prepare3 %p flags=0x%x", dconn, destflags);
|
||||||
cookiein = cookieout;
|
VIR_STEAL_PTR(cookiein, cookieout);
|
||||||
cookieinlen = cookieoutlen;
|
cookieinlen = cookieoutlen;
|
||||||
cookieout = NULL;
|
|
||||||
cookieoutlen = 0;
|
cookieoutlen = 0;
|
||||||
if (useParams) {
|
if (useParams) {
|
||||||
if (virTypedParamsReplaceString(¶ms, &nparams,
|
if (virTypedParamsReplaceString(¶ms, &nparams,
|
||||||
@ -3111,9 +3110,8 @@ virDomainMigrateVersion3Full(virDomainPtr domain,
|
|||||||
*/
|
*/
|
||||||
VIR_DEBUG("Perform3 %p uri=%s", domain->conn, uri);
|
VIR_DEBUG("Perform3 %p uri=%s", domain->conn, uri);
|
||||||
VIR_FREE(cookiein);
|
VIR_FREE(cookiein);
|
||||||
cookiein = cookieout;
|
VIR_STEAL_PTR(cookiein, cookieout);
|
||||||
cookieinlen = cookieoutlen;
|
cookieinlen = cookieoutlen;
|
||||||
cookieout = NULL;
|
|
||||||
cookieoutlen = 0;
|
cookieoutlen = 0;
|
||||||
/* dconnuri not relevant in non-P2P modes, so left NULL here */
|
/* dconnuri not relevant in non-P2P modes, so left NULL here */
|
||||||
if (useParams) {
|
if (useParams) {
|
||||||
@ -3150,9 +3148,8 @@ virDomainMigrateVersion3Full(virDomainPtr domain,
|
|||||||
*/
|
*/
|
||||||
VIR_DEBUG("Finish3 %p ret=%d", dconn, ret);
|
VIR_DEBUG("Finish3 %p ret=%d", dconn, ret);
|
||||||
VIR_FREE(cookiein);
|
VIR_FREE(cookiein);
|
||||||
cookiein = cookieout;
|
VIR_STEAL_PTR(cookiein, cookieout);
|
||||||
cookieinlen = cookieoutlen;
|
cookieinlen = cookieoutlen;
|
||||||
cookieout = NULL;
|
|
||||||
cookieoutlen = 0;
|
cookieoutlen = 0;
|
||||||
if (useParams) {
|
if (useParams) {
|
||||||
if (virTypedParamsGetString(params, nparams,
|
if (virTypedParamsGetString(params, nparams,
|
||||||
@ -3227,9 +3224,8 @@ virDomainMigrateVersion3Full(virDomainPtr domain,
|
|||||||
if (notify_source) {
|
if (notify_source) {
|
||||||
VIR_DEBUG("Confirm3 %p ret=%d domain=%p", domain->conn, ret, domain);
|
VIR_DEBUG("Confirm3 %p ret=%d domain=%p", domain->conn, ret, domain);
|
||||||
VIR_FREE(cookiein);
|
VIR_FREE(cookiein);
|
||||||
cookiein = cookieout;
|
VIR_STEAL_PTR(cookiein, cookieout);
|
||||||
cookieinlen = cookieoutlen;
|
cookieinlen = cookieoutlen;
|
||||||
cookieout = NULL;
|
|
||||||
cookieoutlen = 0;
|
cookieoutlen = 0;
|
||||||
if (useParams) {
|
if (useParams) {
|
||||||
ret = domain->conn->driver->domainMigrateConfirm3Params
|
ret = domain->conn->driver->domainMigrateConfirm3Params
|
||||||
|
@ -1468,8 +1468,7 @@ phypGetBackingDevice(virConnectPtr conn, const char *managed_system,
|
|||||||
if (VIR_STRDUP(backing_device, char_ptr) < 0)
|
if (VIR_STRDUP(backing_device, char_ptr) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
} else {
|
} else {
|
||||||
backing_device = ret;
|
VIR_STEAL_PTR(backing_device, ret);
|
||||||
ret = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char_ptr = strchr(backing_device, '\n');
|
char_ptr = strchr(backing_device, '\n');
|
||||||
|
@ -11645,8 +11645,7 @@ qemuDomainCreateDeviceRecursive(const char *device,
|
|||||||
}
|
}
|
||||||
VIR_FREE(devTmp);
|
VIR_FREE(devTmp);
|
||||||
VIR_FREE(target);
|
VIR_FREE(target);
|
||||||
target = tmp;
|
VIR_STEAL_PTR(target, tmp);
|
||||||
tmp = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qemuDomainCreateDeviceRecursive(target, data,
|
if (qemuDomainCreateDeviceRecursive(target, data,
|
||||||
@ -12601,8 +12600,7 @@ qemuDomainAttachDeviceMknodRecursive(virQEMUDriverPtr driver,
|
|||||||
}
|
}
|
||||||
VIR_FREE(fileTmp);
|
VIR_FREE(fileTmp);
|
||||||
VIR_FREE(target);
|
VIR_FREE(target);
|
||||||
target = tmp;
|
VIR_STEAL_PTR(target, tmp);
|
||||||
tmp = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data.target = target;
|
data.target = target;
|
||||||
|
@ -6655,11 +6655,9 @@ qemuDomainSaveImageUpdateDef(virQEMUDriverPtr driver,
|
|||||||
virFreeError(err);
|
virFreeError(err);
|
||||||
|
|
||||||
/* use the user provided XML */
|
/* use the user provided XML */
|
||||||
ret = newdef;
|
VIR_STEAL_PTR(ret, newdef);
|
||||||
newdef = NULL;
|
|
||||||
} else {
|
} else {
|
||||||
ret = newdef_migr;
|
VIR_STEAL_PTR(ret, newdef_migr);
|
||||||
newdef_migr = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
@ -12705,10 +12703,8 @@ qemuDomainMigratePerform(virDomainPtr dom,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & VIR_MIGRATE_PEER2PEER) {
|
if (flags & VIR_MIGRATE_PEER2PEER)
|
||||||
dconnuri = uri;
|
VIR_STEAL_PTR(dconnuri, uri);
|
||||||
uri = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Do not output cookies in v2 protocol, since the cookie
|
/* Do not output cookies in v2 protocol, since the cookie
|
||||||
* length was not sufficiently large, causing failures
|
* length was not sufficiently large, causing failures
|
||||||
|
@ -4170,9 +4170,8 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriverPtr driver,
|
|||||||
VIR_MIGRATE_AUTO_CONVERGE);
|
VIR_MIGRATE_AUTO_CONVERGE);
|
||||||
|
|
||||||
VIR_DEBUG("Prepare3 %p", dconn);
|
VIR_DEBUG("Prepare3 %p", dconn);
|
||||||
cookiein = cookieout;
|
VIR_STEAL_PTR(cookiein, cookieout);
|
||||||
cookieinlen = cookieoutlen;
|
cookieinlen = cookieoutlen;
|
||||||
cookieout = NULL;
|
|
||||||
cookieoutlen = 0;
|
cookieoutlen = 0;
|
||||||
if (flags & VIR_MIGRATE_TUNNELLED) {
|
if (flags & VIR_MIGRATE_TUNNELLED) {
|
||||||
if (!(st = virStreamNew(dconn, 0)))
|
if (!(st = virStreamNew(dconn, 0)))
|
||||||
@ -4239,9 +4238,8 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriverPtr driver,
|
|||||||
VIR_DEBUG("Perform3 %p uri=%s", sconn, NULLSTR(uri));
|
VIR_DEBUG("Perform3 %p uri=%s", sconn, NULLSTR(uri));
|
||||||
qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_PERFORM3);
|
qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_PERFORM3);
|
||||||
VIR_FREE(cookiein);
|
VIR_FREE(cookiein);
|
||||||
cookiein = cookieout;
|
VIR_STEAL_PTR(cookiein, cookieout);
|
||||||
cookieinlen = cookieoutlen;
|
cookieinlen = cookieoutlen;
|
||||||
cookieout = NULL;
|
|
||||||
cookieoutlen = 0;
|
cookieoutlen = 0;
|
||||||
if (flags & VIR_MIGRATE_TUNNELLED) {
|
if (flags & VIR_MIGRATE_TUNNELLED) {
|
||||||
ret = qemuMigrationSrcPerformTunnel(driver, vm, st, persist_xml,
|
ret = qemuMigrationSrcPerformTunnel(driver, vm, st, persist_xml,
|
||||||
@ -4281,9 +4279,8 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriverPtr driver,
|
|||||||
*/
|
*/
|
||||||
VIR_DEBUG("Finish3 %p ret=%d", dconn, ret);
|
VIR_DEBUG("Finish3 %p ret=%d", dconn, ret);
|
||||||
VIR_FREE(cookiein);
|
VIR_FREE(cookiein);
|
||||||
cookiein = cookieout;
|
VIR_STEAL_PTR(cookiein, cookieout);
|
||||||
cookieinlen = cookieoutlen;
|
cookieinlen = cookieoutlen;
|
||||||
cookieout = NULL;
|
|
||||||
cookieoutlen = 0;
|
cookieoutlen = 0;
|
||||||
|
|
||||||
if (useParams) {
|
if (useParams) {
|
||||||
@ -4362,9 +4359,8 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriverPtr driver,
|
|||||||
*/
|
*/
|
||||||
VIR_DEBUG("Confirm3 %p cancelled=%d vm=%p", sconn, cancelled, vm);
|
VIR_DEBUG("Confirm3 %p cancelled=%d vm=%p", sconn, cancelled, vm);
|
||||||
VIR_FREE(cookiein);
|
VIR_FREE(cookiein);
|
||||||
cookiein = cookieout;
|
VIR_STEAL_PTR(cookiein, cookieout);
|
||||||
cookieinlen = cookieoutlen;
|
cookieinlen = cookieoutlen;
|
||||||
cookieout = NULL;
|
|
||||||
cookieoutlen = 0;
|
cookieoutlen = 0;
|
||||||
ret = qemuMigrationSrcConfirmPhase(driver, vm,
|
ret = qemuMigrationSrcConfirmPhase(driver, vm,
|
||||||
cookiein, cookieinlen,
|
cookiein, cookieinlen,
|
||||||
|
@ -355,8 +355,7 @@ create_profile(const char *profile, const char *profile_name,
|
|||||||
if (!(tmp = virStringReplace(pcontent, template_end, replace_files)))
|
if (!(tmp = virStringReplace(pcontent, template_end, replace_files)))
|
||||||
goto clean_all;
|
goto clean_all;
|
||||||
VIR_FREE(pcontent);
|
VIR_FREE(pcontent);
|
||||||
pcontent = tmp;
|
VIR_STEAL_PTR(pcontent, tmp);
|
||||||
tmp = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* write the file */
|
/* write the file */
|
||||||
|
@ -1936,8 +1936,7 @@ storageVolCreateXML(virStoragePoolPtr pool,
|
|||||||
|
|
||||||
VIR_INFO("Creating volume '%s' in storage pool '%s'",
|
VIR_INFO("Creating volume '%s' in storage pool '%s'",
|
||||||
newvol->name, def->name);
|
newvol->name, def->name);
|
||||||
vol = newvol;
|
VIR_STEAL_PTR(vol, newvol);
|
||||||
newvol = NULL;
|
|
||||||
voldef = NULL;
|
voldef = NULL;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
@ -2130,8 +2129,7 @@ storageVolCreateXMLFrom(virStoragePoolPtr pool,
|
|||||||
|
|
||||||
VIR_INFO("Creating volume '%s' in storage pool '%s'",
|
VIR_INFO("Creating volume '%s' in storage pool '%s'",
|
||||||
newvol->name, def->name);
|
newvol->name, def->name);
|
||||||
vol = newvol;
|
VIR_STEAL_PTR(vol, newvol);
|
||||||
newvol = NULL;
|
|
||||||
voldef = NULL;
|
voldef = NULL;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
@ -5595,8 +5595,7 @@ testNodeDeviceCreateXML(virConnectPtr conn,
|
|||||||
if (VIR_STRDUP(dev->parentName, def->parent) < 0)
|
if (VIR_STRDUP(dev->parentName, def->parent) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
ret = dev;
|
VIR_STEAL_PTR(ret, dev);
|
||||||
dev = NULL;
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virNodeDeviceObjEndAPI(&obj);
|
virNodeDeviceObjEndAPI(&obj);
|
||||||
|
@ -762,8 +762,7 @@ virDBusMessageIterEncode(DBusMessageIter *rootiter,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
VIR_FREE(contsig);
|
VIR_FREE(contsig);
|
||||||
iter = newiter;
|
VIR_STEAL_PTR(iter, newiter);
|
||||||
newiter = NULL;
|
|
||||||
types = t + 1;
|
types = t + 1;
|
||||||
nstruct = skiplen;
|
nstruct = skiplen;
|
||||||
narray = (size_t)va_arg(args, int);
|
narray = (size_t)va_arg(args, int);
|
||||||
@ -789,8 +788,7 @@ virDBusMessageIterEncode(DBusMessageIter *rootiter,
|
|||||||
VIR_FREE(newiter);
|
VIR_FREE(newiter);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
iter = newiter;
|
VIR_STEAL_PTR(iter, newiter);
|
||||||
newiter = NULL;
|
|
||||||
types = vsig;
|
types = vsig;
|
||||||
nstruct = strlen(types);
|
nstruct = strlen(types);
|
||||||
narray = (size_t)-1;
|
narray = (size_t)-1;
|
||||||
@ -821,8 +819,7 @@ virDBusMessageIterEncode(DBusMessageIter *rootiter,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
VIR_FREE(contsig);
|
VIR_FREE(contsig);
|
||||||
iter = newiter;
|
VIR_STEAL_PTR(iter, newiter);
|
||||||
newiter = NULL;
|
|
||||||
types = t + 1;
|
types = t + 1;
|
||||||
nstruct = skiplen - 2;
|
nstruct = skiplen - 2;
|
||||||
narray = (size_t)-1;
|
narray = (size_t)-1;
|
||||||
@ -1059,8 +1056,7 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter,
|
|||||||
nstruct, narray) < 0)
|
nstruct, narray) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
VIR_FREE(contsig);
|
VIR_FREE(contsig);
|
||||||
iter = newiter;
|
VIR_STEAL_PTR(iter, newiter);
|
||||||
newiter = NULL;
|
|
||||||
types = t + 1;
|
types = t + 1;
|
||||||
nstruct = skiplen;
|
nstruct = skiplen;
|
||||||
if (arrayref) {
|
if (arrayref) {
|
||||||
@ -1090,8 +1086,7 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter,
|
|||||||
VIR_DEBUG("Push failed");
|
VIR_DEBUG("Push failed");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
iter = newiter;
|
VIR_STEAL_PTR(iter, newiter);
|
||||||
newiter = NULL;
|
|
||||||
types = vsig;
|
types = vsig;
|
||||||
nstruct = strlen(types);
|
nstruct = strlen(types);
|
||||||
narray = (size_t)-1;
|
narray = (size_t)-1;
|
||||||
@ -1118,8 +1113,7 @@ virDBusMessageIterDecode(DBusMessageIter *rootiter,
|
|||||||
nstruct, narray) < 0)
|
nstruct, narray) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
VIR_FREE(contsig);
|
VIR_FREE(contsig);
|
||||||
iter = newiter;
|
VIR_STEAL_PTR(iter, newiter);
|
||||||
newiter = NULL;
|
|
||||||
types = t + 1;
|
types = t + 1;
|
||||||
nstruct = skiplen - 2;
|
nstruct = skiplen - 2;
|
||||||
narray = (size_t)-1;
|
narray = (size_t)-1;
|
||||||
|
@ -406,8 +406,7 @@ virRotatingFileWriterRollover(virRotatingFileWriterPtr file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
VIR_FREE(nextpath);
|
VIR_FREE(nextpath);
|
||||||
nextpath = thispath;
|
VIR_STEAL_PTR(nextpath, thispath);
|
||||||
thispath = NULL;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1233,8 +1233,7 @@ virStorageFileGetMetadataFromFD(const char *path,
|
|||||||
* update the metadata.*/
|
* update the metadata.*/
|
||||||
meta->type = VIR_STORAGE_TYPE_DIR;
|
meta->type = VIR_STORAGE_TYPE_DIR;
|
||||||
meta->format = VIR_STORAGE_FILE_DIR;
|
meta->format = VIR_STORAGE_FILE_DIR;
|
||||||
ret = meta;
|
VIR_STEAL_PTR(ret, meta);
|
||||||
meta = NULL;
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1256,8 +1255,7 @@ virStorageFileGetMetadataFromFD(const char *path,
|
|||||||
else if (S_ISBLK(sb.st_mode))
|
else if (S_ISBLK(sb.st_mode))
|
||||||
meta->type = VIR_STORAGE_TYPE_BLOCK;
|
meta->type = VIR_STORAGE_TYPE_BLOCK;
|
||||||
|
|
||||||
ret = meta;
|
VIR_STEAL_PTR(ret, meta);
|
||||||
meta = NULL;
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virStorageSourceFree(meta);
|
virStorageSourceFree(meta);
|
||||||
|
@ -182,12 +182,8 @@ vzDestroyDriverConnection(void)
|
|||||||
vzConnPtr privconn_list;
|
vzConnPtr privconn_list;
|
||||||
|
|
||||||
virMutexLock(&vz_driver_lock);
|
virMutexLock(&vz_driver_lock);
|
||||||
driver = vz_driver;
|
VIR_STEAL_PTR(driver, vz_driver);
|
||||||
vz_driver = NULL;
|
VIR_STEAL_PTR(privconn_list, vz_conn_list);
|
||||||
|
|
||||||
privconn_list = vz_conn_list;
|
|
||||||
vz_conn_list = NULL;
|
|
||||||
|
|
||||||
virMutexUnlock(&vz_driver_lock);
|
virMutexUnlock(&vz_driver_lock);
|
||||||
|
|
||||||
while (privconn_list) {
|
while (privconn_list) {
|
||||||
@ -3203,9 +3199,8 @@ vzDomainMigratePerformP2P(virDomainObjPtr dom,
|
|||||||
VIR_MIGRATE_PARAM_DEST_XML, dom_xml) < 0)
|
VIR_MIGRATE_PARAM_DEST_XML, dom_xml) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
cookiein = cookieout;
|
VIR_STEAL_PTR(cookiein, cookieout);
|
||||||
cookieinlen = cookieoutlen;
|
cookieinlen = cookieoutlen;
|
||||||
cookieout = NULL;
|
|
||||||
cookieoutlen = 0;
|
cookieoutlen = 0;
|
||||||
virObjectUnlock(dom);
|
virObjectUnlock(dom);
|
||||||
ret = dconn->driver->domainMigratePrepare3Params
|
ret = dconn->driver->domainMigratePrepare3Params
|
||||||
@ -3226,9 +3221,8 @@ vzDomainMigratePerformP2P(virDomainObjPtr dom,
|
|||||||
}
|
}
|
||||||
|
|
||||||
VIR_FREE(cookiein);
|
VIR_FREE(cookiein);
|
||||||
cookiein = cookieout;
|
VIR_STEAL_PTR(cookiein, cookieout);
|
||||||
cookieinlen = cookieoutlen;
|
cookieinlen = cookieoutlen;
|
||||||
cookieout = NULL;
|
|
||||||
cookieoutlen = 0;
|
cookieoutlen = 0;
|
||||||
if (vzDomainMigratePerformStep(dom, driver, params, nparams, cookiein,
|
if (vzDomainMigratePerformStep(dom, driver, params, nparams, cookiein,
|
||||||
cookieinlen, flags) < 0) {
|
cookieinlen, flags) < 0) {
|
||||||
|
@ -928,8 +928,7 @@ prlsdkParseNetAddress(char *addr)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
ip->prefix = nbits;
|
ip->prefix = nbits;
|
||||||
|
|
||||||
ret = ip;
|
VIR_STEAL_PTR(ret, ip);
|
||||||
ip = NULL;
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (!ret)
|
if (!ret)
|
||||||
@ -4768,8 +4767,7 @@ prlsdkParseSnapshotTree(const char *treexml)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = snapshots;
|
VIR_STEAL_PTR(ret, snapshots);
|
||||||
snapshots = NULL;
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainSnapshotObjListFree(snapshots);
|
virDomainSnapshotObjListFree(snapshots);
|
||||||
|
@ -51,8 +51,7 @@ testCompareXMLToConfFiles(const char *inxml, const char *outconf, dnsmasqCapsPtr
|
|||||||
"except-interface=lo\n")))
|
"except-interface=lo\n")))
|
||||||
goto fail;
|
goto fail;
|
||||||
VIR_FREE(actual);
|
VIR_FREE(actual);
|
||||||
actual = tmp;
|
VIR_STEAL_PTR(actual, tmp);
|
||||||
tmp = NULL;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (virTestCompareToFile(actual, outconf) < 0)
|
if (virTestCompareToFile(actual, outconf) < 0)
|
||||||
|
@ -8423,8 +8423,7 @@ cmdDesc(vshControl *ctl, const vshCmd *cmd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
VIR_FREE(desc);
|
VIR_FREE(desc);
|
||||||
desc = desc_edited;
|
VIR_STEAL_PTR(desc, desc_edited);
|
||||||
desc_edited = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virDomainSetMetadata(dom, type, desc, NULL, NULL, flags) < 0) {
|
if (virDomainSetMetadata(dom, type, desc, NULL, NULL, flags) < 0) {
|
||||||
|
@ -1356,8 +1356,7 @@ virshSnapshotListCollect(vshControl *ctl, virDomainPtr dom,
|
|||||||
virshSnapSorter);
|
virshSnapSorter);
|
||||||
snaplist->nsnaps -= deleted;
|
snaplist->nsnaps -= deleted;
|
||||||
|
|
||||||
ret = snaplist;
|
VIR_STEAL_PTR(ret, snaplist);
|
||||||
snaplist = NULL;
|
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virshSnapshotListFree(snaplist);
|
virshSnapshotListFree(snaplist);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user