On 05/25/2010 07:24 AM, Daniel P. Berrange wrote:
This proof of concept shows how two existing uses of virExec
and virRun can be ported to the new virCommand APIs, and how
much simpler the code becomes
Love it!
- va_start(args, arg);
-
while ((s = va_arg(args, const char *)))
- if (!(argv[n++] = strdup(s)))
- goto error;
-
+ virCommandAddArg(cmd, s);
va_end(args);
Hmm - at first, I wondered why coverity did not detect the missing
va_end() call on the oom case pre-patch. But on further investigation,
it looks like your patch is based off an older commit, since the missing
va_end() was already fixed in commit d564fcb3, so you'll have a slight
conflict to resolve when you rebase.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org