Sourceware Bugzilla – Bug 10441
Backtraces code example lacks error checking
Last modified: 2009-07-24 13:39:35 UTC
On this page:
there's a code example near the bottom of the page.
That code makes use of the return value from "backtrace_symbols", without
first checking if the returned pointer is NULL.
You might argue that this code is just to get the general idea across, and is
rightfully devoid of error checking. That's obviously an editorial decision.
What I can say is that, perhaps like many other people, I followed that
example's structure without giving it much more thought, and in doing so
unwittingly introducing a bug into my application. So for that reason you
might want to add error handling to the example code.