From: Peter Krempa Date: Mon, 7 Apr 2014 15:58:08 +0000 (+0200) Subject: util: storagefile: Add function to free a virStorageSourcePtr X-Git-Tag: v1.2.4-rc1~67 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0bd54a10bd2eb886112f46c5cc99125fa9953481;p=thirdparty%2Flibvirt.git util: storagefile: Add function to free a virStorageSourcePtr Add a free function as some parts of the code will allocate the structure. --- diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 972b184e33..f4ba406dd6 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1842,6 +1842,7 @@ virStorageNetHostTransportTypeToString; virStorageNetProtocolTypeToString; virStorageSourceAuthClear; virStorageSourceClear; +virStorageSourceFree; virStorageSourceGetActualType; virStorageSourcePoolDefFree; virStorageSourcePoolModeTypeFromString; diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index f4d5b2cfdf..4486b758e5 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -1719,3 +1719,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 2e9312f9d3..0e5136e8a1 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__ */