Add a free function as some parts of the code will allocate the
structure.
---
src/libvirt_private.syms | 1 +
src/util/virstoragefile.c | 11 +++++++++++
src/util/virstoragefile.h | 1 +
3 files changed, 13 insertions(+)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 0e81f2f..69c986f 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1843,6 +1843,7 @@ virStorageNetHostTransportTypeToString;
virStorageNetProtocolTypeToString;
virStorageSourceAuthClear;
virStorageSourceClear;
+virStorageSourceFree;
virStorageSourceGetActualType;
virStorageSourcePoolDefFree;
virStorageSourcePoolModeTypeFromString;
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 2d6be17..7f853a4 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -1712,3 +1712,14 @@ virStorageSourceClear(virStorageSourcePtr def)
virStorageNetHostDefFree(def->nhosts, def->hosts);
virStorageSourceAuthClear(def);
}
+
+
+void
+virStorageSourceFree(virStorageSourcePtr def)
+{
+ if (!def)
+ return;
+
+ virStorageSourceClear(def);
+ VIR_FREE(def);
+}
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
index 2e9312f..0e5136e 100644
--- a/src/util/virstoragefile.h
+++ b/src/util/virstoragefile.h
@@ -333,5 +333,6 @@ void virStorageSourceAuthClear(virStorageSourcePtr def);
void virStorageSourcePoolDefFree(virStorageSourcePoolDefPtr def);
void virStorageSourceClear(virStorageSourcePtr def);
int virStorageSourceGetActualType(virStorageSourcePtr def);
+void virStorageSourceFree(virStorageSourcePtr def);
#endif /* __VIR_STORAGE_FILE_H__ */
--
1.9.1