Signed-off-by: Seeteena Thoufeek <s1seetee(a)linux.vnet.ibm.com>
---
src/qemu/qemu_agent.c | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 9ea2c59563..1583a4eee2 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -2274,10 +2274,9 @@ qemuAgentSetUserPassword(qemuAgentPtr agent,
const char *password,
bool crypted)
{
- int ret = -1;
- virJSONValuePtr cmd = NULL;
- virJSONValuePtr reply = NULL;
- char *password64 = NULL;
+ g_autoptr(virJSONValue) cmd = NULL;
+ g_autoptr(virJSONValue) reply = NULL;
+ g_autofree char *password64 = NULL;
password64 = g_base64_encode((unsigned char *)password,
strlen(password));
@@ -2287,18 +2286,12 @@ qemuAgentSetUserPassword(qemuAgentPtr agent,
"s:username", user,
"s:password", password64,
NULL)))
- goto cleanup;
+ return -1;
if (qemuAgentCommand(agent, cmd, &reply, agent->timeout) < 0)
- goto cleanup;
-
- ret = 0;
+ return -1;
- cleanup:
- virJSONValueFree(cmd);
- virJSONValueFree(reply);
- VIR_FREE(password64);
- return ret;
+ return 0;
}
/* Returns: 0 on success
--
2.18.2