By making use of the GCC's __attribute__((cleanup)) handled by VIR_AUTOPTR
macro, majority of the calls to *Free functions can be dropped, which in
turn leads to getting rid of most of our cleanup sections.
---
src/util/virbitmap.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
index ef18dad..37e5c0e 100644
--- a/src/util/virbitmap.c
+++ b/src/util/virbitmap.c
@@ -1202,15 +1202,12 @@ char *
virBitmapDataFormat(const void *data,
int len)
{
- virBitmapPtr map = NULL;
- char *ret = NULL;
+ VIR_AUTOPTR(virBitmapPtr) map = NULL;
if (!(map = virBitmapNewData(data, len)))
return NULL;
- ret = virBitmapFormat(map);
- virBitmapFree(map);
- return ret;
+ return virBitmapFormat(map);
}
--
1.8.3.1