From 3776b6a93d7e2d24f52eab7a2fdc1e0067d0f588 Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Wed, 16 Jun 2021 10:04:30 +0200 Subject: [PATCH] conf: storage: Introduce virStoragePoolSourceListFree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- src/conf/storage_conf.c | 16 ++++++++++++++++ src/conf/storage_conf.h | 5 +++++ src/libvirt_private.syms | 1 + 3 files changed, 22 insertions(+) diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index 0ecdb0969a..2aa9a3d8f9 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -1803,3 +1803,19 @@ virStoragePoolSourceListFormat(virStoragePoolSourceList *def) return virBufferContentAndReset(&buf); } + + +void +virStoragePoolSourceListFree(virStoragePoolSourceList *list) +{ + size_t i; + + if (!list) + return; + + for (i = 0; i < list->nsources; i++) + virStoragePoolSourceClear(&list->sources[i]); + + g_free(list->sources); + g_free(list); +} diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h index 345026aa37..76efaac531 100644 --- a/src/conf/storage_conf.h +++ b/src/conf/storage_conf.h @@ -266,6 +266,11 @@ struct _virStoragePoolSourceList { virStoragePoolSource *sources; }; +void +virStoragePoolSourceListFree(virStoragePoolSourceList *list); +G_DEFINE_AUTOPTR_CLEANUP_FUNC(virStoragePoolSourceList, virStoragePoolSourceListFree); + + virStoragePoolDef * virStoragePoolDefParseXML(xmlXPathContextPtr ctxt); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 2efa787664..68e4b6aab8 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1048,6 +1048,7 @@ virStoragePoolSourceClear; virStoragePoolSourceDeviceClear; virStoragePoolSourceFree; virStoragePoolSourceListFormat; +virStoragePoolSourceListFree; virStoragePoolSourceListNewSource; virStoragePoolTypeFromString; virStoragePoolTypeToString;