
2010/9/1 Eric Blake <eblake@redhat.com>:
* src/lxc/veth.h (vethCreate): Change prototype. * src/lxc/veth.c (vethCreate): Always malloc veth2, and allocate veth1 if needed. (getFreeVethName): Adjust signature, and use virAsprintf. * src/lxc/lxc_driver.c (lxcSetupInterfaces): Adjust caller. ---
This issue crossed file boundaries. It was a bit tricky, since vethCreate was used in two patterns - one where the parent name was already known, and another where the parent name is picked as the first available option. But the end result avoids strdup'ing a fixed-width buffer, and I think I correctly avoided any leaks (in lxcSetupInterfaces, once a string is transferred to *veths, then returning failure will cause that string to be freed in the caller). It also gets rid of a PATH_MAX stack over-allocation.
Looks good, ACK. Matthias