From: Ján Tomko Date: Mon, 13 Dec 2021 18:47:25 +0000 (+0100) Subject: docs: use g_auto in virCommand example X-Git-Tag: v8.0.0-rc1~192 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7624796ac82a13a09e4c46cea13ae5af5aba3463;p=thirdparty%2Flibvirt.git docs: use g_auto in virCommand example Signed-off-by: Ján Tomko Reviewed-by: Michal Privoznik --- 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); }