Frank Cusack <fcusack@fcusack.com> wrote:
Apparently, it CAN happen that handle is not NULL, but I have to assume that this line of code doesn't think that can happen. (Because of course, it is a pretty bad idea to return a non-NULL handle on failure, and ltdl is obviously not written by idiots.)
Intelligent is not the same as competent. In this case, if (errors > 0), they should return NULL. That results in a memory leak if "handle" wasn't freed, but correct code. As it stands now, they have no *requirement* in that function that it returns NULL on error. It's just an accidental side effect of them sometimes freeing handle.
You can't just read this one line of code and say "handle is returned!", you have to look at what is expected from try_dlopen().
Yes. I've looked at the code, and have no idea what it's doing or why. In any case, I think I'm going to run some analysis on it in the next few weeks, so I should have results as to what execution path causes the problem, and why.
Bah. I didn't realize lt_dlhandle was opaque (because how does gdb know what it looks like). phooey. OK, we'll need to patch ltdl.c, but otherwise (ie autoconf stuff) we can still get away with untouched original source.
Ok. Alan DeKok.