cppcheck icon indicating copy to clipboard operation
cppcheck copied to clipboard

Fix #9657 FP on missing va_end() after non-returning function

Open chrchr-github opened this issue 1 year ago • 3 comments

chrchr-github avatar Jul 11 '24 21:07 chrchr-github

I am not sure this is actually a false positive.

From https://en.cppreference.com/w/c/variadic/va_end:

[...] if va_end is not called before a function that calls va_start or va_copy returns, the behavior is undefined. 

firewave avatar Jul 16 '24 16:07 firewave

I guess the point is that the function that calls va_start (check_noret_va_end()) doesn't return, since it calls a noreturn function.

chrchr-github avatar Jul 16 '24 18:07 chrchr-github

If that function exits that should be of no concern but if thrown an exception that is probably a different story. I think this needs to be treated like an allocation until we have more insight.

firewave avatar Jul 16 '24 18:07 firewave