mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-01 17:35:17 +00:00
qemuMigrationCookieGraphicsSpiceAlloc: Refactor memory handling
Use modern memory handling approach to simplify the code. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
85d6d515ed
commit
f3e087ac9c
@ -192,13 +192,10 @@ qemuMigrationCookieGraphicsSpiceAlloc(virQEMUDriverPtr driver,
|
||||
virDomainGraphicsDefPtr def,
|
||||
virDomainGraphicsListenDefPtr glisten)
|
||||
{
|
||||
qemuMigrationCookieGraphicsPtr mig = NULL;
|
||||
g_autoptr(qemuMigrationCookieGraphics) mig = g_new0(qemuMigrationCookieGraphics, 1);
|
||||
const char *listenAddr;
|
||||
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
|
||||
|
||||
if (VIR_ALLOC(mig) < 0)
|
||||
goto error;
|
||||
|
||||
mig->type = VIR_DOMAIN_GRAPHICS_TYPE_SPICE;
|
||||
mig->port = def->data.spice.port;
|
||||
if (cfg->spiceTLS)
|
||||
@ -211,15 +208,11 @@ qemuMigrationCookieGraphicsSpiceAlloc(virQEMUDriverPtr driver,
|
||||
|
||||
if (cfg->spiceTLS &&
|
||||
!(mig->tlsSubject = qemuDomainExtractTLSSubject(cfg->spiceTLSx509certdir)))
|
||||
goto error;
|
||||
return NULL;
|
||||
|
||||
mig->listen = g_strdup(listenAddr);
|
||||
|
||||
return mig;
|
||||
|
||||
error:
|
||||
qemuMigrationCookieGraphicsFree(mig);
|
||||
return NULL;
|
||||
return g_steal_pointer(&mig);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user