conf: snapshot: Provide a function to free virDomainSnapshotDiskDefPtr

Tests will need to parse such a definition so it also needs to be freed.
Provide a function for it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2018-09-04 16:02:43 +02:00
parent 3b8135b03e
commit 50e1e053a5
2 changed files with 14 additions and 0 deletions

View File

@ -99,6 +99,17 @@ virDomainSnapshotDiskDefClear(virDomainSnapshotDiskDefPtr disk)
disk->src = NULL;
}
void
virDomainSnapshotDiskDefFree(virDomainSnapshotDiskDefPtr disk)
{
if (!disk)
return;
virDomainSnapshotDiskDefClear(disk);
VIR_FREE(disk);
}
/* Allocate a new virDomainSnapshotDef; free with virObjectUnref() */
virDomainSnapshotDefPtr
virDomainSnapshotDefNew(void)

View File

@ -30,3 +30,6 @@ virDomainSnapshotDiskDefParseXML(xmlNodePtr node,
virDomainSnapshotDiskDefPtr def,
unsigned int flags,
virDomainXMLOptionPtr xmlopt);
void
virDomainSnapshotDiskDefFree(virDomainSnapshotDiskDefPtr disk);