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:
parent
6d68e0df72
commit
bb8895290c
@ -142,7 +142,7 @@ virCommandNewArgList(const char *binary, ...)
|
|||||||
const char *arg;
|
const char *arg;
|
||||||
|
|
||||||
if (!cmd || cmd->has_error)
|
if (!cmd || cmd->has_error)
|
||||||
return NULL;
|
return cmd;
|
||||||
|
|
||||||
va_start(list, binary);
|
va_start(list, binary);
|
||||||
while ((arg = va_arg(list, const char *)) != NULL)
|
while ((arg = va_arg(list, const char *)) != NULL)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user