[libvirt] [PATCH 05/10] qemu: command: Use VIR_AUTO infrastructure in qemuBuildDiskSourceCommandLine

Peter Krempa posted 10 patches 6 years, 7 months ago
[libvirt] [PATCH 05/10] qemu: command: Use VIR_AUTO infrastructure in qemuBuildDiskSourceCommandLine
Posted by Peter Krempa 6 years, 7 months ago
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/qemu/qemu_command.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index acfec8a1bb..1ae8a00352 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2560,8 +2560,8 @@ qemuBuildDiskSourceCommandLine(virCommandPtr cmd,
                                virQEMUCapsPtr qemuCaps)
 {
     VIR_AUTOPTR(qemuBlockStorageSourceChainData) data = NULL;
-    virJSONValuePtr copyOnReadProps = NULL;
-    char *str = NULL;
+    VIR_AUTOPTR(virJSONValue) copyOnReadProps = NULL;
+    VIR_AUTOFREE(char *) copyOnReadPropsStr = NULL;
     size_t i;
     int ret = -1;

@@ -2590,18 +2590,15 @@ qemuBuildDiskSourceCommandLine(virCommandPtr cmd,
     }

     if (copyOnReadProps) {
-        if (!(str = virJSONValueToString(copyOnReadProps, false)))
+        if (!(copyOnReadPropsStr = virJSONValueToString(copyOnReadProps, false)))
             goto cleanup;

-        virCommandAddArgList(cmd, "-blockdev", str, NULL);
-        VIR_FREE(str);
+        virCommandAddArgList(cmd, "-blockdev", copyOnReadPropsStr, NULL);
     }

     ret = 0;

  cleanup:
-    virJSONValueFree(copyOnReadProps);
-    VIR_FREE(str);
     return ret;
 }

-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 05/10] qemu: command: Use VIR_AUTO infrastructure in qemuBuildDiskSourceCommandLine
Posted by Ján Tomko 6 years, 7 months ago
On Mon, Jun 24, 2019 at 05:38:50PM +0200, Peter Krempa wrote:
>Signed-off-by: Peter Krempa <pkrempa@redhat.com>
>---
> src/qemu/qemu_command.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

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