Signed-off-by: Peter Krempa <pkrempa(a)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