qemu: use g_auto in qemuExtTPMStartEmulator

Use the g_auto macros wherever possible to eliminate the cleanup
section.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Ján Tomko 2020-01-24 19:32:21 +01:00
parent 3efdbae5bf
commit ebe9c31f41

View File

@ -794,12 +794,12 @@ qemuExtTPMStartEmulator(virQEMUDriverPtr driver,
bool incomingMigration)
{
int ret = -1;
virCommandPtr cmd = NULL;
g_autoptr(virCommand) cmd = NULL;
int exitstatus = 0;
char *errbuf = NULL;
virQEMUDriverConfigPtr cfg;
g_autofree char *errbuf = NULL;
g_autoptr(virQEMUDriverConfig) cfg = NULL;
virDomainTPMDefPtr tpm = vm->def->tpm;
char *shortName = virDomainDefGetShortName(vm->def);
g_autofree char *shortName = virDomainDefGetShortName(vm->def);
int cmdret = 0, timeout, rc;
pid_t pid;
@ -855,12 +855,6 @@ qemuExtTPMStartEmulator(virQEMUDriverPtr driver,
ret = 0;
cleanup:
VIR_FREE(shortName);
VIR_FREE(errbuf);
virCommandFree(cmd);
virObjectUnref(cfg);
return ret;
error: