mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 21:34:54 +03:00
qemu: use automatic cleanup for virCommand
Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
eff68d3637
commit
d9fdc65a51
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user