From ef36cc5058938b133686154fd649b7131a81ab3b Mon Sep 17 00:00:00 2001 From: Jiang Jiacheng Date: Fri, 6 Jan 2023 17:18:34 +0800 Subject: [PATCH] remote: use g_autofree and remove unnecessary label MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jiang Jiacheng Reviewed-by: Jonathon Jongsma Reviewed-by: Ján Tomko Signed-off-by: Ján Tomko --- src/remote/remote_driver.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 7946e9d9bd..8fa9d20593 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -3841,23 +3841,19 @@ struct remoteAuthInteractState { static int remoteAuthFillFromConfig(virConnectPtr conn, struct remoteAuthInteractState *state) { - int ret = -1; int ninteract; const char *credname; - char *path = NULL; + g_autofree char *path = NULL; VIR_DEBUG("Trying to fill auth parameters from config file"); if (!state->config) { if (virAuthGetConfigFilePath(conn, &path) < 0) - goto cleanup; - if (path == NULL) { - ret = 0; - goto cleanup; - } - + return -1; + if (path == NULL) + return 0; if (!(state->config = virAuthConfigNew(path))) - goto cleanup; + return -1; } for (ninteract = 0; state->interact[ninteract].id != 0; ninteract++) { @@ -3887,7 +3883,7 @@ static int remoteAuthFillFromConfig(virConnectPtr conn, VIR_URI_SERVER(conn->uri), credname, &value) < 0) - goto cleanup; + return -1; if (value) { state->interact[ninteract].result = value; @@ -3895,11 +3891,7 @@ static int remoteAuthFillFromConfig(virConnectPtr conn, } } - ret = 0; - - cleanup: - VIR_FREE(path); - return ret; + return 0; } -- 2.39.5