From: Peter Krempa Date: Mon, 24 Jun 2019 13:47:48 +0000 (+0200) Subject: qemu: command: Use VIR_AUTO infrastructure in qemuBuildDiskSourceCommandLine X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=29e4368382cc7dede95c267d763b0a12d27df070;p=libvirt.git qemu: command: Use VIR_AUTO infrastructure in qemuBuildDiskSourceCommandLine Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 70e1b586cc..0baae43339 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; }