There are several calls to virBufferFreeAndReset() when functions
encounter an error, but the caller never uses the virBuffer once an
error has been encountered (all callers detect error by looking at the
function return value, not the contents of the virBuffer being
operated on), and now that all virBuffers are auto-freed there is no
reason for the lower level functions like these to spend time freeing
a buffer that is guaranteed to be freed momentarily anyway.
Signed-off-by: Laine Stump <laine(a)redhat.com>
---
src/conf/checkpoint_conf.c | 1 -
src/conf/domain_conf.c | 1 -
src/conf/snapshot_conf.c | 1 -
src/libxl/xen_xl.c | 1 -
src/util/virsysinfo.c | 1 -
src/util/virxml.c | 1 -
6 files changed, 6 deletions(-)
diff --git a/src/conf/checkpoint_conf.c b/src/conf/checkpoint_conf.c
index e0dce9c2ed..41f67bd895 100644
--- a/src/conf/checkpoint_conf.c
+++ b/src/conf/checkpoint_conf.c
@@ -493,7 +493,6 @@ virDomainCheckpointDefFormatInternal(virBufferPtr buf,
return 0;
error:
- virBufferFreeAndReset(buf);
return -1;
}
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 33bf0a1727..e5070ed871 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -30038,7 +30038,6 @@ virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
return 0;
error:
- virBufferFreeAndReset(buf);
return -1;
}
diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index 9767592bfc..b7ed3b42df 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -916,7 +916,6 @@ virDomainSnapshotDefFormatInternal(virBufferPtr buf,
return 0;
error:
- virBufferFreeAndReset(buf);
return -1;
}
diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c
index ec5e4791a3..4baf5e336e 100644
--- a/src/libxl/xen_xl.c
+++ b/src/libxl/xen_xl.c
@@ -1432,7 +1432,6 @@ xenFormatXLVnode(virConfValuePtr list,
ret = 0;
cleanup:
- virBufferFreeAndReset(buf);
return ret;
}
diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c
index dbca99c1ef..e69fc51a1e 100644
--- a/src/util/virsysinfo.c
+++ b/src/util/virsysinfo.c
@@ -1581,7 +1581,6 @@ virSysinfoFormat(virBufferPtr buf, virSysinfoDefPtr def)
virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected sysinfo type model %d"),
def->type);
- virBufferFreeAndReset(buf);
return -1;
}
diff --git a/src/util/virxml.c b/src/util/virxml.c
index e9ea9fe1a4..56e6f67597 100644
--- a/src/util/virxml.c
+++ b/src/util/virxml.c
@@ -1283,7 +1283,6 @@ virXMLValidatorValidate(virXMLValidatorPtr validator,
ret = 0;
cleanup:
- virBufferFreeAndReset(&validator->buf);
return ret;
}
--
2.25.4