On Wed, Mar 06, 2019 at 09:20:46AM +0100, Peter Krempa wrote:
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/conf/domain_conf.c | 90 +++++++++++++-----------------------------
1 file changed, 28 insertions(+), 62 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f48b41da87..ea4fbf2280 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -24102,7 +24095,7 @@ virDomainDiskDefFormatPrivateData(virBufferPtr buf,
unsigned int flags,
virDomainXMLOptionPtr xmlopt)
{
- virBuffer childBuf = VIR_BUFFER_INITIALIZER;
+ VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
if (!(flags & VIR_DOMAIN_DEF_FORMAT_STATUS) ||
!xmlopt ||
@@ -24112,16 +24105,9 @@ virDomainDiskDefFormatPrivateData(virBufferPtr buf,
virBufferSetChildIndent(&childBuf, buf);
if (xmlopt->privateData.diskFormat(disk, &childBuf) < 0)
- goto error;
-
- if (virXMLFormatElement(buf, "privateData", NULL, &childBuf) < 0)
- goto error;
-
- return 0;
+ return -1;
- error:
- virBufferFreeAndReset(&childBuf);
- return -1;
+ return virXMLFormatElement(buf, "privateData", NULL, &childBuf);
}
You could have left the error: label here, save the cleanups for a
separate patch (maybe after we've VIR_AUTOMATIZED all the things!)
@@ -24259,7 +24245,7 @@ static int
virDomainControllerDriverFormat(virBufferPtr buf,
virDomainControllerDefPtr def)
{
- virBuffer driverBuf = VIR_BUFFER_INITIALIZER;
+ VIR_AUTOCLEAN(virBuffer) driverBuf = VIR_BUFFER_INITIALIZER;
if (def->queues)
virBufferAsprintf(&driverBuf, " queues='%u'",
def->queues);
Technically not needed, but given our tendency to initialize variables
even when not necessary, this makes perfect sense.
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano