mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-21 19:02:25 +00:00
docs: use g_auto in virCommand example
Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
7e41c10b95
commit
7624796ac8
@ -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);
|
||||
}
|
||||
</pre>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user