util: buffer: use VIR_AUTOPTR for aggregate types

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@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Sukrit Bhatnagar 2018-07-24 21:22:06 +05:30 committed by Erik Skultety
parent 013a7b9ef2
commit d0a92a0371

View File

@ -694,7 +694,7 @@ virBufferEscapeN(virBufferPtr buf,
char *out;
const char *cur;
virBufferEscapePair escapeItem;
virBufferEscapePairPtr escapeList = NULL;
VIR_AUTOPTR(virBufferEscapePair) escapeList = NULL;
size_t nescapeList = 0;
va_list ap;
@ -752,7 +752,6 @@ virBufferEscapeN(virBufferPtr buf,
cleanup:
va_end(ap);
VIR_FREE(escapeList);
}