提交 0c5d8300 编写于 作者: P Peter Krempa

qemu: domain: Use VIR_AUTOCLEAN for virBuffer

Replace all uses where virBuffer would need clearing on the cleanup
path.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
上级 55ee6ac8
...@@ -2174,7 +2174,7 @@ static int ...@@ -2174,7 +2174,7 @@ static int
qemuStorageSourcePrivateDataFormat(virStorageSourcePtr src, qemuStorageSourcePrivateDataFormat(virStorageSourcePtr src,
virBufferPtr buf) virBufferPtr buf)
{ {
virBuffer tmp = VIR_BUFFER_INITIALIZER; VIR_AUTOCLEAN(virBuffer) tmp = VIR_BUFFER_INITIALIZER;
qemuDomainStorageSourcePrivatePtr srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src); qemuDomainStorageSourcePrivatePtr srcPriv = QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src);
int ret = -1; int ret = -1;
...@@ -2209,7 +2209,6 @@ qemuStorageSourcePrivateDataFormat(virStorageSourcePtr src, ...@@ -2209,7 +2209,6 @@ qemuStorageSourcePrivateDataFormat(virStorageSourcePtr src,
ret = 0; ret = 0;
cleanup: cleanup:
virBufferFreeAndReset(&tmp);
return ret; return ret;
} }
...@@ -2345,9 +2344,9 @@ static int ...@@ -2345,9 +2344,9 @@ static int
qemuDomainObjPrivateXMLFormatNBDMigrationSource(virBufferPtr buf, qemuDomainObjPrivateXMLFormatNBDMigrationSource(virBufferPtr buf,
virStorageSourcePtr src) virStorageSourcePtr src)
{ {
virBuffer attrBuf = VIR_BUFFER_INITIALIZER; VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
virBuffer childBuf = VIR_BUFFER_INITIALIZER; VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
virBuffer privateDataBuf = VIR_BUFFER_INITIALIZER; VIR_AUTOCLEAN(virBuffer) privateDataBuf = VIR_BUFFER_INITIALIZER;
int ret = -1; int ret = -1;
virBufferSetChildIndent(&childBuf, buf); virBufferSetChildIndent(&childBuf, buf);
...@@ -2373,10 +2372,6 @@ qemuDomainObjPrivateXMLFormatNBDMigrationSource(virBufferPtr buf, ...@@ -2373,10 +2372,6 @@ qemuDomainObjPrivateXMLFormatNBDMigrationSource(virBufferPtr buf,
ret = 0; ret = 0;
cleanup: cleanup:
virBufferFreeAndReset(&attrBuf);
virBufferFreeAndReset(&childBuf);
virBufferFreeAndReset(&privateDataBuf);
return ret; return ret;
} }
...@@ -2385,8 +2380,8 @@ static int ...@@ -2385,8 +2380,8 @@ static int
qemuDomainObjPrivateXMLFormatNBDMigration(virBufferPtr buf, qemuDomainObjPrivateXMLFormatNBDMigration(virBufferPtr buf,
virDomainObjPtr vm) virDomainObjPtr vm)
{ {
virBuffer attrBuf = VIR_BUFFER_INITIALIZER; VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
virBuffer childBuf = VIR_BUFFER_INITIALIZER; VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
size_t i; size_t i;
virDomainDiskDefPtr disk; virDomainDiskDefPtr disk;
qemuDomainDiskPrivatePtr diskPriv; qemuDomainDiskPrivatePtr diskPriv;
...@@ -2413,9 +2408,6 @@ qemuDomainObjPrivateXMLFormatNBDMigration(virBufferPtr buf, ...@@ -2413,9 +2408,6 @@ qemuDomainObjPrivateXMLFormatNBDMigration(virBufferPtr buf,
ret = 0; ret = 0;
cleanup: cleanup:
virBufferFreeAndReset(&attrBuf);
virBufferFreeAndReset(&childBuf);
return ret; return ret;
} }
...@@ -2425,8 +2417,8 @@ qemuDomainObjPrivateXMLFormatJob(virBufferPtr buf, ...@@ -2425,8 +2417,8 @@ qemuDomainObjPrivateXMLFormatJob(virBufferPtr buf,
virDomainObjPtr vm, virDomainObjPtr vm,
qemuDomainObjPrivatePtr priv) qemuDomainObjPrivatePtr priv)
{ {
virBuffer attrBuf = VIR_BUFFER_INITIALIZER; VIR_AUTOCLEAN(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
virBuffer childBuf = VIR_BUFFER_INITIALIZER; VIR_AUTOCLEAN(virBuffer) childBuf = VIR_BUFFER_INITIALIZER;
qemuDomainJob job = priv->job.active; qemuDomainJob job = priv->job.active;
int ret = -1; int ret = -1;
...@@ -2465,9 +2457,6 @@ qemuDomainObjPrivateXMLFormatJob(virBufferPtr buf, ...@@ -2465,9 +2457,6 @@ qemuDomainObjPrivateXMLFormatJob(virBufferPtr buf,
ret = 0; ret = 0;
cleanup: cleanup:
virBufferFreeAndReset(&attrBuf);
virBufferFreeAndReset(&childBuf);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册