[reSIProcate] misc safety and leak fixes: ares, rutil, stack
Hi,
A static code analysis tool revealed a number of issues in ares, rutil and stack. Included are proposed patches with my fixes. These fixes include:
* memory leaks (in error cases), where fix now properly frees memory
* double frees, where callee free'd message and then caller also free's it
* new asserts, to make it clear that there is unhandled error case
* missing return code checking, where that code indicates if dynamic memory allocation took place
* missing case breaks and missing FALLTHRU comments indicating missing break is expected
* comments, for cases where I don't know how to fix it (constructors that don't initialize all member variables are an example)
* Fixes where system call return value was being used instead of errno.
* Restructuring of StatisticManager's AtomicPayload from stack variable into member variable, both to reduce stack utilization and allow StatisticsMessage to be queued without getting stack corruption.
All code compiles and checks pass.
I plan to commit to trunk this week -- please let me know if you see any issues. Any corrections are greatly appreciated. I'm just trying to make the analysis tool happy, I'm not wedded to any particular fix.
I'm working on similar fixes for dum, but that might not be ready until after the holidays.
Thanks,
Kennard
Attachment:
cov-ares1.patch
Description: Binary data
Attachment:
cov-stack1.patch
Description: Binary data
Attachment:
cov-rutil2.patch
Description: Binary data