That way devstr will only be used for the device string.

Signed-off-by: Ján Tomko <jto...@redhat.com>
---
 src/qemu/qemu_command.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index cc589a70b2..6557643dbe 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -9197,6 +9197,7 @@ qemuBuildShmemCommandLine(virLogManagerPtr logManager,
     VIR_AUTOPTR(virJSONValue) memProps = NULL;
     VIR_AUTOCLEAN(virBuffer) buf = VIR_BUFFER_INITIALIZER;
     char *devstr = NULL;
+    VIR_AUTOFREE(char *) chardev = NULL;
     int rc;
     unsigned int cdevflags = QEMU_BUILD_CHARDEV_TCP_NOWAIT |
         QEMU_BUILD_CHARDEV_UNIX_FD_PASS;
@@ -9267,16 +9268,15 @@ qemuBuildShmemCommandLine(virLogManagerPtr logManager,
     VIR_FREE(devstr);
 
     if (shmem->server.enabled) {
-        devstr = qemuBuildChrChardevStr(logManager, secManager,
+        chardev = qemuBuildChrChardevStr(logManager, secManager,
                                         cmd, cfg, def,
                                         &shmem->server.chr,
                                         shmem->info.alias, qemuCaps,
                                         cdevflags);
-        if (!devstr)
+        if (!chardev)
             return -1;
 
-        virCommandAddArgList(cmd, "-chardev", devstr, NULL);
-        VIR_FREE(devstr);
+        virCommandAddArgList(cmd, "-chardev", chardev, NULL);
     }
 
     return 0;
-- 
2.19.2

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

Reply via email to