1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00

lxc: refactor virLXCProcessBuildControllerCmd

Use automatic cleanup and remove the labels.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Ján Tomko 2021-12-10 14:49:23 +01:00
parent fe9d5d6d00
commit 1e6b81cdec

View File

@ -935,7 +935,7 @@ virLXCProcessBuildControllerCmd(virLXCDriver *driver,
size_t i;
g_autofree char *filterstr = NULL;
g_autofree char *outputstr = NULL;
virCommand *cmd;
g_autoptr(virCommand) cmd = NULL;
g_autoptr(virLXCDriverConfig) cfg = virLXCDriverGetConfig(driver);
cmd = virCommandNew(vm->def->emulator);
@ -955,7 +955,7 @@ virLXCProcessBuildControllerCmd(virLXCDriver *driver,
if (cfg->log_libvirtd) {
if (virLogGetNbOutputs() > 0) {
if (!(outputstr = virLogGetOutputs()))
goto error;
return NULL;
virCommandAddEnvPair(cmd, "LIBVIRT_LOG_OUTPUTS", outputstr);
}
@ -1007,12 +1007,7 @@ virLXCProcessBuildControllerCmd(virLXCDriver *driver,
* write the live domain status XML with the PID */
virCommandRequireHandshake(cmd);
cleanup:
return cmd;
error:
virCommandFree(cmd);
cmd = NULL;
goto cleanup;
return g_steal_pointer(&cmd);
}