From 6cc25a6bc62e00085a8d3426bb1f6f7c5154c9c8 Mon Sep 17 00:00:00 2001 From: Tim Wiederhake Date: Mon, 5 Jul 2021 12:46:52 +0200 Subject: [PATCH] virDomainSEVDefParseXML: Use automatic memory management MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tim Wiederhake Reviewed-by: Ján Tomko Signed-off-by: Ján Tomko --- src/conf/domain_conf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index dda615a8ba..dd803e6df5 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -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; }