[libvirt PATCH 11/11] vircommand: Simplify virCommandAddArg

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

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/util/vircommand.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index 223010c6aa..f83d49ffac 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -1520,21 +1520,16 @@ virCommandAddEnvXDG(virCommandPtr cmd, const char *baseDir)
 void
 virCommandAddArg(virCommandPtr cmd, const char *val)
 {
-    char *arg;
-
     if (!cmd || cmd->has_error)
         return;
 
-    arg = g_strdup(val);
-
     /* Arg plus trailing NULL. */
     if (VIR_RESIZE_N(cmd->args, cmd->maxargs, cmd->nargs, 1 + 1) < 0) {
-        VIR_FREE(arg);
         cmd->has_error = ENOMEM;
         return;
     }
 
-    cmd->args[cmd->nargs++] = arg;
+    cmd->args[cmd->nargs++] = g_strdup(val);
 }
 
 
-- 
2.26.2




[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