]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
command: avoid leak on failure
authorEric Blake <eblake@redhat.com>
Thu, 2 Jun 2011 21:50:11 +0000 (15:50 -0600)
committerEric Blake <eblake@redhat.com>
Fri, 3 Jun 2011 14:11:42 +0000 (08:11 -0600)
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

index 288958eb3ffba7c7684bd5fb7c66a6a51e136553..a2f7ff62233653fc3aa72fe425c6ed97e3ef8139 100644 (file)
@@ -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)