mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemuMigrationCookieXMLParse: Avoid VIR_FREE when parsing lockstate
Restructure the control-flow a bit using an temporary variable to avoid the need to use VIR_FREE. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
78d330bde1
commit
49530d5277
@ -1215,15 +1215,18 @@ qemuMigrationCookieXMLParse(qemuMigrationCookiePtr mig,
|
||||
|
||||
if ((flags & QEMU_MIGRATION_COOKIE_LOCKSTATE) &&
|
||||
virXPathBoolean("count(./lockstate) > 0", ctxt)) {
|
||||
g_autofree char *lockState = NULL;
|
||||
|
||||
mig->lockDriver = virXPathString("string(./lockstate[1]/@driver)", ctxt);
|
||||
if (!mig->lockDriver) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Missing lock driver name in migration cookie"));
|
||||
return -1;
|
||||
}
|
||||
mig->lockState = virXPathString("string(./lockstate[1]/leases[1])", ctxt);
|
||||
if (mig->lockState && STREQ(mig->lockState, ""))
|
||||
VIR_FREE(mig->lockState);
|
||||
|
||||
lockState = virXPathString("string(./lockstate[1]/leases[1])", ctxt);
|
||||
if (STRNEQ_NULLABLE(lockState, ""))
|
||||
mig->lockState = g_steal_pointer(&lockState);
|
||||
}
|
||||
|
||||
if ((flags & QEMU_MIGRATION_COOKIE_PERSISTENT) &&
|
||||
|
Loading…
Reference in New Issue
Block a user