addrs) < 0)
goto cleanup;
- ret = addrs;
- addrs = NULL;
+ VIR_STEAL_PTR(ret, addrs);
cleanup:
virDomainVirtioSerialAddrSetFree(addrs);
return ret;
goto cleanup;
hub->nports = nports;
- ret = hub;
- hub = NULL;
+ VIR_STEAL_PTR(ret, hub);
cleanup:
virDomainUSBAddressHubFree(hub);
return ret;
goto cleanup;
}
- ret = ip;
- ip = NULL;
+ VIR_STEAL_PTR(ret, ip);
cleanup:
VIR_FREE(prefixStr);
goto error;
}
- if (!address) {
- address = addressCompat;
- addressCompat = NULL;
- }
+ if (!address)
+ VIR_STEAL_PTR(address, addressCompat);
}
if (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET) {
goto error;
}
- if (!socketPath) {
- socketPath = socketCompat;
- socketCompat = NULL;
- }
+ if (!socketPath)
+ VIR_STEAL_PTR(socketPath, socketCompat);
}
if (address && address[0] &&
goto cleanup;
- ret = def;
- def = NULL;
+ VIR_STEAL_PTR(ret, def);
cleanup:
ctxt->node = save;
VIR_FREE(tmp);
}
}
- ret = iommu;
- iommu = NULL;
+ VIR_STEAL_PTR(ret, iommu);
cleanup:
ctxt->node = save;
if (virXPathNode("./usage", ctxt) != NULL
&& virSecretDefParseUsage(ctxt, def) < 0)
goto cleanup;
- ret = def;
- def = NULL;
+ VIR_STEAL_PTR(ret, def);
cleanup:
VIR_FREE(prop);
node) < 0)
goto cleanup;
- ret = def;
- def = NULL;
+ VIR_STEAL_PTR(ret, def);
cleanup:
virStoragePoolSourceFree(def);
xmlFreeDoc(doc);
obj->persistent = !(flags & VIR_NETWORK_OBJ_LIST_ADD_LIVE);
}
- ret = obj;
- obj = NULL;
+ VIR_STEAL_PTR(ret, obj);
cleanup:
virNetworkObjEndAPI(&obj);
virObjectRef(obj);
}
- ret = obj;
- obj = NULL;
+ VIR_STEAL_PTR(ret, obj);
cleanup:
virSecretObjEndAPI(&obj);
VIR_MIGRATE_AUTO_CONVERGE);
VIR_DEBUG("Prepare3 %p flags=0x%x", dconn, destflags);
- cookiein = cookieout;
+ VIR_STEAL_PTR(cookiein, cookieout);
cookieinlen = cookieoutlen;
- cookieout = NULL;
cookieoutlen = 0;
if (useParams) {
if (virTypedParamsReplaceString(¶ms, &nparams,
*/
VIR_DEBUG("Perform3 %p uri=%s", domain->conn, uri);
VIR_FREE(cookiein);
- cookiein = cookieout;
+ VIR_STEAL_PTR(cookiein, cookieout);
cookieinlen = cookieoutlen;
- cookieout = NULL;
cookieoutlen = 0;
/* dconnuri not relevant in non-P2P modes, so left NULL here */
if (useParams) {
*/
VIR_DEBUG("Finish3 %p ret=%d", dconn, ret);
VIR_FREE(cookiein);
- cookiein = cookieout;
+ VIR_STEAL_PTR(cookiein, cookieout);
cookieinlen = cookieoutlen;
- cookieout = NULL;
cookieoutlen = 0;
if (useParams) {
if (virTypedParamsGetString(params, nparams,
if (notify_source) {
VIR_DEBUG("Confirm3 %p ret=%d domain=%p", domain->conn, ret, domain);
VIR_FREE(cookiein);
- cookiein = cookieout;
+ VIR_STEAL_PTR(cookiein, cookieout);
cookieinlen = cookieoutlen;
- cookieout = NULL;
cookieoutlen = 0;
if (useParams) {
ret = domain->conn->driver->domainMigrateConfirm3Params
if (VIR_STRDUP(backing_device, char_ptr) < 0)
goto cleanup;
} else {
- backing_device = ret;
- ret = NULL;
+ VIR_STEAL_PTR(backing_device, ret);
}
char_ptr = strchr(backing_device, '\n');
}
VIR_FREE(devTmp);
VIR_FREE(target);
- target = tmp;
- tmp = NULL;
+ VIR_STEAL_PTR(target, tmp);
}
if (qemuDomainCreateDeviceRecursive(target, data,
}
VIR_FREE(fileTmp);
VIR_FREE(target);
- target = tmp;
- tmp = NULL;
+ VIR_STEAL_PTR(target, tmp);
}
data.target = target;
virFreeError(err);
/* use the user provided XML */
- ret = newdef;
- newdef = NULL;
+ VIR_STEAL_PTR(ret, newdef);
} else {
- ret = newdef_migr;
- newdef_migr = NULL;
+ VIR_STEAL_PTR(ret, newdef_migr);
}
cleanup:
goto cleanup;
}
- if (flags & VIR_MIGRATE_PEER2PEER) {
- dconnuri = uri;
- uri = NULL;
- }
+ if (flags & VIR_MIGRATE_PEER2PEER)
+ VIR_STEAL_PTR(dconnuri, uri);
/* Do not output cookies in v2 protocol, since the cookie
* length was not sufficiently large, causing failures
VIR_MIGRATE_AUTO_CONVERGE);
VIR_DEBUG("Prepare3 %p", dconn);
- cookiein = cookieout;
+ VIR_STEAL_PTR(cookiein, cookieout);
cookieinlen = cookieoutlen;
- cookieout = NULL;
cookieoutlen = 0;
if (flags & VIR_MIGRATE_TUNNELLED) {
if (!(st = virStreamNew(dconn, 0)))
VIR_DEBUG("Perform3 %p uri=%s", sconn, NULLSTR(uri));
qemuMigrationJobSetPhase(driver, vm, QEMU_MIGRATION_PHASE_PERFORM3);
VIR_FREE(cookiein);
- cookiein = cookieout;
+ VIR_STEAL_PTR(cookiein, cookieout);
cookieinlen = cookieoutlen;
- cookieout = NULL;
cookieoutlen = 0;
if (flags & VIR_MIGRATE_TUNNELLED) {
ret = qemuMigrationSrcPerformTunnel(driver, vm, st, persist_xml,
*/
VIR_DEBUG("Finish3 %p ret=%d", dconn, ret);
VIR_FREE(cookiein);
- cookiein = cookieout;
+ VIR_STEAL_PTR(cookiein, cookieout);
cookieinlen = cookieoutlen;
- cookieout = NULL;
cookieoutlen = 0;
if (useParams) {
*/
VIR_DEBUG("Confirm3 %p cancelled=%d vm=%p", sconn, cancelled, vm);
VIR_FREE(cookiein);
- cookiein = cookieout;
+ VIR_STEAL_PTR(cookiein, cookieout);
cookieinlen = cookieoutlen;
- cookieout = NULL;
cookieoutlen = 0;
ret = qemuMigrationSrcConfirmPhase(driver, vm,
cookiein, cookieinlen,
if (!(tmp = virStringReplace(pcontent, template_end, replace_files)))
goto clean_all;
VIR_FREE(pcontent);
- pcontent = tmp;
- tmp = NULL;
+ VIR_STEAL_PTR(pcontent, tmp);
}
/* write the file */
VIR_INFO("Creating volume '%s' in storage pool '%s'",
newvol->name, def->name);
- vol = newvol;
- newvol = NULL;
+ VIR_STEAL_PTR(vol, newvol);
voldef = NULL;
cleanup:
VIR_INFO("Creating volume '%s' in storage pool '%s'",
newvol->name, def->name);
- vol = newvol;
- newvol = NULL;
+ VIR_STEAL_PTR(vol, newvol);
voldef = NULL;
cleanup:
if (VIR_STRDUP(dev->parentName, def->parent) < 0)
goto cleanup;
- ret = dev;
- dev = NULL;
+ VIR_STEAL_PTR(ret, dev);
cleanup:
virNodeDeviceObjEndAPI(&obj);
goto cleanup;
}
VIR_FREE(contsig);
- iter = newiter;
- newiter = NULL;
+ VIR_STEAL_PTR(iter, newiter);
types = t + 1;
nstruct = skiplen;
narray = (size_t)va_arg(args, int);
VIR_FREE(newiter);
goto cleanup;
}
- iter = newiter;
- newiter = NULL;
+ VIR_STEAL_PTR(iter, newiter);
types = vsig;
nstruct = strlen(types);
narray = (size_t)-1;
goto cleanup;
}
VIR_FREE(contsig);
- iter = newiter;
- newiter = NULL;
+ VIR_STEAL_PTR(iter, newiter);
types = t + 1;
nstruct = skiplen - 2;
narray = (size_t)-1;
nstruct, narray) < 0)
goto cleanup;
VIR_FREE(contsig);
- iter = newiter;
- newiter = NULL;
+ VIR_STEAL_PTR(iter, newiter);
types = t + 1;
nstruct = skiplen;
if (arrayref) {
VIR_DEBUG("Push failed");
goto cleanup;
}
- iter = newiter;
- newiter = NULL;
+ VIR_STEAL_PTR(iter, newiter);
types = vsig;
nstruct = strlen(types);
narray = (size_t)-1;
nstruct, narray) < 0)
goto cleanup;
VIR_FREE(contsig);
- iter = newiter;
- newiter = NULL;
+ VIR_STEAL_PTR(iter, newiter);
types = t + 1;
nstruct = skiplen - 2;
narray = (size_t)-1;
}
VIR_FREE(nextpath);
- nextpath = thispath;
- thispath = NULL;
+ VIR_STEAL_PTR(nextpath, thispath);
}
}
* update the metadata.*/
meta->type = VIR_STORAGE_TYPE_DIR;
meta->format = VIR_STORAGE_FILE_DIR;
- ret = meta;
- meta = NULL;
+ VIR_STEAL_PTR(ret, meta);
goto cleanup;
}
else if (S_ISBLK(sb.st_mode))
meta->type = VIR_STORAGE_TYPE_BLOCK;
- ret = meta;
- meta = NULL;
+ VIR_STEAL_PTR(ret, meta);
cleanup:
virStorageSourceFree(meta);
vzConnPtr privconn_list;
virMutexLock(&vz_driver_lock);
- driver = vz_driver;
- vz_driver = NULL;
-
- privconn_list = vz_conn_list;
- vz_conn_list = NULL;
-
+ VIR_STEAL_PTR(driver, vz_driver);
+ VIR_STEAL_PTR(privconn_list, vz_conn_list);
virMutexUnlock(&vz_driver_lock);
while (privconn_list) {
VIR_MIGRATE_PARAM_DEST_XML, dom_xml) < 0)
goto done;
- cookiein = cookieout;
+ VIR_STEAL_PTR(cookiein, cookieout);
cookieinlen = cookieoutlen;
- cookieout = NULL;
cookieoutlen = 0;
virObjectUnlock(dom);
ret = dconn->driver->domainMigratePrepare3Params
}
VIR_FREE(cookiein);
- cookiein = cookieout;
+ VIR_STEAL_PTR(cookiein, cookieout);
cookieinlen = cookieoutlen;
- cookieout = NULL;
cookieoutlen = 0;
if (vzDomainMigratePerformStep(dom, driver, params, nparams, cookiein,
cookieinlen, flags) < 0) {
goto cleanup;
ip->prefix = nbits;
- ret = ip;
- ip = NULL;
+ VIR_STEAL_PTR(ret, ip);
cleanup:
if (!ret)
goto cleanup;
}
- ret = snapshots;
- snapshots = NULL;
+ VIR_STEAL_PTR(ret, snapshots);
cleanup:
virDomainSnapshotObjListFree(snapshots);
"except-interface=lo\n")))
goto fail;
VIR_FREE(actual);
- actual = tmp;
- tmp = NULL;
+ VIR_STEAL_PTR(actual, tmp);
#endif
if (virTestCompareToFile(actual, outconf) < 0)
}
VIR_FREE(desc);
- desc = desc_edited;
- desc_edited = NULL;
+ VIR_STEAL_PTR(desc, desc_edited);
}
if (virDomainSetMetadata(dom, type, desc, NULL, NULL, flags) < 0) {
virshSnapSorter);
snaplist->nsnaps -= deleted;
- ret = snaplist;
- snaplist = NULL;
+ VIR_STEAL_PTR(ret, snaplist);
cleanup:
virshSnapshotListFree(snaplist);