mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
virDomainDefParseIOThreads: Use g_autoptr() for @iothrid
Using g_autoptr() for @iothrid variable inside virDomainDefParseIOThreads() allows us to drop explicit call to virDomainIOThreadIDDefFree() in one case. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
95c95f1b75
commit
d10b6b4c89
@ -17047,7 +17047,8 @@ virDomainDefParseIOThreads(virDomainDef *def,
|
||||
def->iothreadids = g_new0(virDomainIOThreadIDDef *, n);
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
virDomainIOThreadIDDef *iothrid = NULL;
|
||||
g_autoptr(virDomainIOThreadIDDef) iothrid = NULL;
|
||||
|
||||
if (!(iothrid = virDomainIOThreadIDDefParseXML(nodes[i])))
|
||||
return -1;
|
||||
|
||||
@ -17055,10 +17056,9 @@ virDomainDefParseIOThreads(virDomainDef *def,
|
||||
virReportError(VIR_ERR_XML_ERROR,
|
||||
_("duplicate iothread id '%u' found"),
|
||||
iothrid->iothread_id);
|
||||
virDomainIOThreadIDDefFree(iothrid);
|
||||
return -1;
|
||||
}
|
||||
def->iothreadids[def->niothreadids++] = iothrid;
|
||||
def->iothreadids[def->niothreadids++] = g_steal_pointer(&iothrid);
|
||||
}
|
||||
|
||||
return virDomainIOThreadIDDefArrayInit(def, iothreads);
|
||||
|
Loading…
Reference in New Issue
Block a user