]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuBuildSmpCommandLine: use virCommandAddArgBuffer directly
authorJán Tomko <jtomko@redhat.com>
Tue, 20 Aug 2019 11:23:36 +0000 (13:23 +0200)
committerJán Tomko <jtomko@redhat.com>
Mon, 26 Aug 2019 20:16:06 +0000 (22:16 +0200)
Instead of getting the string then passing it to virCommand.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_command.c

index 4c0856274fd5dfe39b96bd9fe6f8fa49ecf4b168..7dc385f0d4eac075111a660c2be84c2affaffbb8 100644 (file)
@@ -7556,7 +7556,6 @@ static int
 qemuBuildSmpCommandLine(virCommandPtr cmd,
                         virDomainDefPtr def)
 {
-    char *smp = NULL;
     VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
     unsigned int maxvcpus = virDomainDefGetVcpusMax(def);
     unsigned int nvcpus = 0;
@@ -7592,10 +7591,7 @@ qemuBuildSmpCommandLine(virCommandPtr cmd,
     if (virBufferCheckError(&buf) < 0)
         return -1;
 
-    smp = virBufferContentAndReset(&buf);
-    virCommandAddArg(cmd, smp);
-    VIR_FREE(smp);
-
+    virCommandAddArgBuffer(cmd, &buf);
     return 0;
 }