Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx> --- src/qemu/qemu_driver.c | 3 +-- src/qemu/qemu_interface.c | 3 +-- src/qemu/qemu_tpm.c | 4 +--- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e444ad2d45..db2b25adbd 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6315,7 +6315,7 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn, { virQEMUDriver *driver = conn->privateData; virDomainObj *vm = NULL; - virCommand *cmd = NULL; + g_autoptr(virCommand) cmd = NULL; char *ret = NULL; size_t i; @@ -6375,7 +6375,6 @@ static char *qemuConnectDomainXMLToNative(virConnectPtr conn, ret = virCommandToString(cmd, false); cleanup: - virCommandFree(cmd); virObjectUnref(vm); return ret; } diff --git a/src/qemu/qemu_interface.c b/src/qemu/qemu_interface.c index ac0168c80d..676bc896d6 100644 --- a/src/qemu/qemu_interface.c +++ b/src/qemu/qemu_interface.c @@ -320,7 +320,7 @@ qemuCreateInBridgePortWithHelper(virQEMUDriverConfig *cfg, int *tapfd, unsigned int flags) { - virCommand *cmd; + g_autoptr(virCommand) cmd = NULL; char *errbuf = NULL, *cmdstr = NULL; int pair[2] = { -1, -1 }; @@ -387,7 +387,6 @@ qemuCreateInBridgePortWithHelper(virQEMUDriverConfig *cfg, cleanup: VIR_FREE(cmdstr); VIR_FREE(errbuf); - virCommandFree(cmd); VIR_FORCE_CLOSE(pair[0]); return *tapfd < 0 ? -1 : 0; } diff --git a/src/qemu/qemu_tpm.c b/src/qemu/qemu_tpm.c index 1b923fd68e..7e7b01768e 100644 --- a/src/qemu/qemu_tpm.c +++ b/src/qemu/qemu_tpm.c @@ -793,7 +793,7 @@ static void qemuTPMEmulatorStop(const char *swtpmStateDir, const char *shortName) { - virCommand *cmd; + g_autoptr(virCommand) cmd = NULL; g_autofree char *pathname = NULL; g_autofree char *errbuf = NULL; g_autofree char *swtpm_ioctl = virTPMGetSwtpmIoctl(); @@ -817,8 +817,6 @@ qemuTPMEmulatorStop(const char *swtpmStateDir, ignore_value(virCommandRun(cmd, NULL)); - virCommandFree(cmd); - /* clean up the socket */ unlink(pathname); } -- 2.31.1