int cookieinlen,
unsigned int flags)
{
- qemuMigrationCookiePtr mig = NULL;
+ g_autoptr(qemuMigrationCookie) mig = NULL;
/* Parse & validate incoming cookie (if any) */
if (cookiein && cookieinlen &&
cookiein[cookieinlen-1] != '\0') {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Migration cookie was not NULL terminated"));
- goto error;
+ return NULL;
}
VIR_DEBUG("cookielen=%d cookie='%s'", cookieinlen, NULLSTR(cookiein));
priv ? priv->qemuCaps : NULL,
cookiein,
flags) < 0)
- goto error;
+ return NULL;
if (flags & QEMU_MIGRATION_COOKIE_PERSISTENT &&
mig->persistent &&
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Missing %s lock state for migration cookie"),
virLockManagerPluginGetName(driver->lockManager));
- goto error;
+ return NULL;
}
} else if (STRNEQ(mig->lockDriver,
virLockManagerPluginGetName(driver->lockManager))) {
_("Source host lock driver %s different from target %s"),
mig->lockDriver,
virLockManagerPluginGetName(driver->lockManager));
- goto error;
+ return NULL;
}
}
if (flags & QEMU_MIGRATION_COOKIE_STATS && mig->jobInfo)
mig->jobInfo->operation = priv->job.current->operation;
- return mig;
-
- error:
- qemuMigrationCookieFree(mig);
- return NULL;
+ return g_steal_pointer(&mig);
}