[libvirt PATCH 1/5] docs: use g_auto in virCommand example

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 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(&amp;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>
 
-- 
2.31.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux