From 5de4d410a2707314d66e61e60e769dc0d160cd30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Mon, 21 Jan 2019 14:48:18 +0100 Subject: [PATCH] virQEMUDriverConfigLoadSWTPMEntry: use VIR_AUTOFREE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Switch the function to use VIR_AUTOFREE and VIR_AUTOPTR macros to get rid of the cleanup section. Requested-by: John Ferlan Signed-off-by: Ján Tomko Reviewed-by: Erik Skultety --- src/qemu/qemu_conf.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 37f09b8e80..2baf13b1c7 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -984,24 +984,20 @@ static int virQEMUDriverConfigLoadSWTPMEntry(virQEMUDriverConfigPtr cfg, virConfPtr conf) { - char *swtpm_user = NULL, *swtpm_group = NULL; - int ret = -1; + VIR_AUTOFREE(char *) swtpm_user = NULL; + VIR_AUTOFREE(char *) swtpm_group = NULL; if (virConfGetValueString(conf, "swtpm_user", &swtpm_user) < 0) - goto cleanup; + return -1; if (swtpm_user && virGetUserID(swtpm_user, &cfg->swtpm_user) < 0) - goto cleanup; + return -1; if (virConfGetValueString(conf, "swtpm_group", &swtpm_group) < 0) - goto cleanup; + return -1; if (swtpm_group && virGetGroupID(swtpm_group, &cfg->swtpm_group) < 0) - goto cleanup; + return -1; - ret = 0; - cleanup: - VIR_FREE(swtpm_user); - VIR_FREE(swtpm_group); - return ret; + return 0; }