Re: [PATCH 07/19] qemu_command: switch to VIR_AUTOCLEAN for virBuffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/20/19 2:59 PM, Ján Tomko wrote:
Simplify the code by annotating all the temporary virBuffers
with VIR_AUTOCLEAN.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
  src/qemu/qemu_command.c | 194 ++++++++++++++--------------------------
  1 file changed, 67 insertions(+), 127 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 60e00042c7..94a6ad546e 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c

@@ -6454,7 +6418,7 @@ qemuBuildVMGenIDCommandLine(virCommandPtr cmd,
                              const virDomainDef *def,
                              virQEMUCapsPtr qemuCaps)
  {
-    virBuffer opts = VIR_BUFFER_INITIALIZER;
+    VIR_AUTOCLEAN(virBuffer) opts = VIR_BUFFER_INITIALIZER;
      char guid[VIR_UUID_STRING_BUFLEN];
if (!def->genidRequested)

Don't forget to remove virBufferFreeAndReset() here.

@@ -9086,7 +9040,7 @@ qemuBuildSmartcardCommandLine(virLogManagerPtr logManager,
      size_t i;
      virDomainSmartcardDefPtr smartcard;
      char *devstr;
-    virBuffer opt = VIR_BUFFER_INITIALIZER;
+    VIR_AUTOCLEAN(virBuffer) opt = VIR_BUFFER_INITIALIZER;
      const char *database;
      const char *contAlias = NULL;
      unsigned int cdevflags = QEMU_BUILD_CHARDEV_TCP_NOWAIT |
@@ -9108,7 +9062,6 @@ qemuBuildSmartcardCommandLine(virLogManagerPtr logManager,
          virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                         _("this QEMU binary lacks multiple smartcard "
                           "support"));
-        virBufferFreeAndReset(&opt);
          return -1;
      }

There are two more virBufferFreeAndReset()-s in this function. Don't forget to remove them too.

Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux