By making use of GNU C's cleanup attribute handled by the
VIR_AUTOPTR macro for declaring aggregate pointer variables,
majority of the calls to *Free functions can be dropped, which
in turn leads to getting rid of most of our cleanup sections.
Signed-off-by: Sukrit Bhatnagar <skrtbhtngr(a)gmail.com>
---
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..5b6e55f 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(virBitmap) map = NULL;
if (!(map = virBitmapNewData(data, len)))
return NULL;
- ret = virBitmapFormat(map);
- virBitmapFree(map);
- return ret;
+ return virBitmapFormat(map);
}
--
1.8.3.1