Initialize return value on all exit paths.
E.g. __libc_start_main goes via "cpp_demangle_read_type" (which fails)
directly to the label "clean". On return rtn is uninitialized and gets
freed in __cxa_demangle itself.
Has this been reviewed or pushed to "upstream" as well?
Ah, no. From a quick glance this seemed to be the upstream. Could you tell me where I should submit it instead?
Sorry for the bad procedure.
Oh I see, you mean libelftc. The code path being corrected only seems to have been introduced into the libcxxrt fork (revision 18482f1).
That said, I have just noticed a second rtn = NULL initialisation later on that's redundant with my patch. If this turns out to be the right forum, I'll update the request with that change too.
This looks good to me. I hit the same issue yesterday but hadn't had a time to debug it, so thanks for chasing it down. Chris: do you want to do the pull, or shall I?
Actually, looking at the libelftc code, they seem to have fixed a few bugs there too, so it's probably worth pulling in a new version and then reapplying the fixes.