Re: RFA: fix minor memory leak in symfile.c

Tom Tromey
2008-09-13T17:58:06Z

>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

>> While auditing other callers of build_id_bfd_get, I found a use of
>> 'free', so I fixed that as well. (Perhaps we ought to poison "free"?)

Joel> I think that's a good idea, since I don't think there is any case
Joel> besides the xfree implementation where we want to call free. Same
Joel> for malloc as well. But I'm not very familiar with the pros and
Joel> cons of this GCC pragma.

It works in the lexer, so it is fairly primitive.

I tried it and ran into a few problems. vec.h uses the token
'free'. struct dict_vector has a field named 'free'. And, bison uses
'free', but IIRC we #define it to xfree somewhere.

So, I think this probably isn't worth pursuing.

I did find a few stray uses of free. I can send that patch if you
like. I'm not even sure if this matters -- I suppose the
justification for xfree is not as strong as that for xmalloc.

Tom