ros/ros_comm — pull request #122 by meyerj (2013-01-09 19:53:38+00:00)
Title: incorrect braces in ros::console::vformatToBuffer() causing a memory leak

The vformatToBuffer() function in rosconsole, that parses the format string for the variadic version of the print function, makes a copy of the argument list to be able to resize the buffer and reevaluate for the case the buffer was too small.

I am not very familiar with cstdarg, but I guess the va_end command should come after the closing brace of the if block in [rosconsole.cpp:513](https://github.com/ros/ros_comm/blob/d339a40fca5eda54bcf27b4353e0f9d62c3763d2/tools/rosconsole/src/rosconsole/rosconsole.cpp#L513), so that the memory allocated during the va_copy call gets freed in every case.

As this function is called for every log line that uses the variadic rosconsole macros this bug might cause a severe memory leak, at least for logging intensive applications.