mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-23 21:15:20 +00:00
conf: use correct free function for virDomainDeviceDef
Simple g_autofree is not enough if we put allocated data into the device structure. Define the AUTOPTR_CLEANUP function and use it here. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reported-by: Xu Yandong <xuyandong2@huawei.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
4ab2120f3b
commit
3f40a487a9
@ -16516,7 +16516,7 @@ virDomainDeviceDefParse(const char *xmlStr,
|
|||||||
g_autoptr(xmlDoc) xml = NULL;
|
g_autoptr(xmlDoc) xml = NULL;
|
||||||
xmlNodePtr node;
|
xmlNodePtr node;
|
||||||
g_autoptr(xmlXPathContext) ctxt = NULL;
|
g_autoptr(xmlXPathContext) ctxt = NULL;
|
||||||
g_autofree virDomainDeviceDefPtr dev = NULL;
|
g_autoptr(virDomainDeviceDef) dev = NULL;
|
||||||
|
|
||||||
if (!(xml = virXMLParseStringCtxt(xmlStr, _("(device_definition)"), &ctxt)))
|
if (!(xml = virXMLParseStringCtxt(xmlStr, _("(device_definition)"), &ctxt)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2916,6 +2916,7 @@ void virDomainRedirdevDefFree(virDomainRedirdevDefPtr def);
|
|||||||
void virDomainRedirFilterDefFree(virDomainRedirFilterDefPtr def);
|
void virDomainRedirFilterDefFree(virDomainRedirFilterDefPtr def);
|
||||||
void virDomainShmemDefFree(virDomainShmemDefPtr def);
|
void virDomainShmemDefFree(virDomainShmemDefPtr def);
|
||||||
void virDomainDeviceDefFree(virDomainDeviceDefPtr def);
|
void virDomainDeviceDefFree(virDomainDeviceDefPtr def);
|
||||||
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainDeviceDef, virDomainDeviceDefFree);
|
||||||
virDomainDeviceDefPtr virDomainDeviceDefCopy(virDomainDeviceDefPtr src,
|
virDomainDeviceDefPtr virDomainDeviceDefCopy(virDomainDeviceDefPtr src,
|
||||||
const virDomainDef *def,
|
const virDomainDef *def,
|
||||||
virDomainXMLOptionPtr xmlopt,
|
virDomainXMLOptionPtr xmlopt,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user