virDomainSEVDefParseXML: Use automatic memory management

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Tim Wiederhake 2021-07-05 12:46:52 +02:00 committed by Ján Tomko
parent 42c0c7275d
commit 6cc25a6bc6

View File

@ -14719,7 +14719,7 @@ virDomainSEVDefParseXML(xmlNodePtr sevNode,
xmlXPathContextPtr ctxt)
{
VIR_XPATH_NODE_AUTORESTORE(ctxt)
virDomainSEVDef *def;
g_autoptr(virDomainSEVDef) def = NULL;
unsigned long policy;
int rc = -1;
@ -14765,10 +14765,9 @@ virDomainSEVDefParseXML(xmlNodePtr sevNode,
def->dh_cert = virXPathString("string(./dhCert)", ctxt);
def->session = virXPathString("string(./session)", ctxt);
return def;
return g_steal_pointer(&def);
error:
virDomainSEVDefFree(def);
return NULL;
}