remove redundant calls to virBufferFreeAndReset()

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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Laine Stump 2020-07-04 18:09:21 -04:00
parent f0f7ad14e9
commit 065f7d5ba9
6 changed files with 0 additions and 6 deletions

View File

@ -493,7 +493,6 @@ virDomainCheckpointDefFormatInternal(virBufferPtr buf,
return 0; return 0;
error: error:
virBufferFreeAndReset(buf);
return -1; return -1;
} }

View File

@ -29970,7 +29970,6 @@ virDomainDefFormatInternalSetRootName(virDomainDefPtr def,
return 0; return 0;
error: error:
virBufferFreeAndReset(buf);
return -1; return -1;
} }

View File

@ -916,7 +916,6 @@ virDomainSnapshotDefFormatInternal(virBufferPtr buf,
return 0; return 0;
error: error:
virBufferFreeAndReset(buf);
return -1; return -1;
} }

View File

@ -1432,7 +1432,6 @@ xenFormatXLVnode(virConfValuePtr list,
ret = 0; ret = 0;
cleanup: cleanup:
virBufferFreeAndReset(buf);
return ret; return ret;
} }

View File

@ -1581,7 +1581,6 @@ virSysinfoFormat(virBufferPtr buf, virSysinfoDefPtr def)
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected sysinfo type model %d"), _("unexpected sysinfo type model %d"),
def->type); def->type);
virBufferFreeAndReset(buf);
return -1; return -1;
} }

View File

@ -1284,7 +1284,6 @@ virXMLValidatorValidate(virXMLValidatorPtr validator,
ret = 0; ret = 0;
cleanup: cleanup:
virBufferFreeAndReset(&validator->buf);
return ret; return ret;
} }