1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

command: avoid leak on failure

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.
This commit is contained in:
Eric Blake 2011-06-02 15:50:11 -06:00
parent 6d68e0df72
commit bb8895290c

View 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)