From 7624796ac82a13a09e4c46cea13ae5af5aba3463 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Mon, 13 Dec 2021 19:47:25 +0100 Subject: [PATCH] docs: use g_auto in virCommand example MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ján Tomko Reviewed-by: Michal Privoznik --- docs/internals/command.html.in | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/docs/internals/command.html.in b/docs/internals/command.html.in index 585ba53a93..d9f53933c6 100644 --- a/docs/internals/command.html.in +++ b/docs/internals/command.html.in @@ -564,14 +564,12 @@ int runhook(const char *drvstr, const char *id, const char *opstr, const char *subopstr, const char *extra) { - int ret; - char *path; - virCommand *cmd; + g_autofree char *path = NULL; + g_autoptr(virCommand) cmd = NULL; virBuildPath(&path, LIBVIRT_HOOK_DIR, drvstr); cmd = virCommandNew(path); - VIR_FREE(path); virCommandAddEnvPassCommon(cmd); @@ -579,11 +577,7 @@ int runhook(const char *drvstr, const char *id, virCommandSetInputBuffer(cmd, input); - ret = virCommandRun(cmd, NULL); - - virCommandFree(cmd); - - return ret; + return virCommandRun(cmd, NULL); }