[PATCH 01/10] command: avoid leak on failure

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

 



Detected by Coverity.  While it is possible on OOM condition, as
well as with bad code that passes binary == NULL, it is unlikely
to be encountered in the wild.

* src/util/command.c (virCommandNewArgList): Don't leak memory.
---
 src/util/command.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/util/command.c b/src/util/command.c
index 288958e..a2f7ff6 100644
--- a/src/util/command.c
+++ b/src/util/command.c
@@ -142,7 +142,7 @@ virCommandNewArgList(const char *binary, ...)
     const char *arg;

     if (!cmd || cmd->has_error)
-        return NULL;
+        return cmd;

     va_start(list, binary);
     while ((arg = va_arg(list, const char *)) != NULL)
-- 
1.7.4.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[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]