[cfe-commits] plug a memory leak in the -E code

Sam Bishop sam at bishop.dhs.org
Mon Mar 3 14:05:00 PST 2008


On Mon, March 3, 2008 2:17 pm, Chris Lattner wrote:
>
> On Mar 3, 2008, at 9:18 AM, Sam Bishop wrote:
>
>> When clang is acting on the -E option, it creates a
>> PrintPPOutputPPCallbacks object but never deletes it.  The object is
>> passed to the Preprocessor object, but it doesn't delete it either.
>>
>> It seems to me that the Driver code ought to do the deleting.  So I
>> have attached a patch which does just that.
>
> Nice catch.  However, I think it makes more sense for the PP to take
> ownership of the callbacks object.  What do you think?

Do the LLVM and clang projects have a general rule of thumb for making
these kinds of decisions?  "The object/module that calls new calls
delete" is the rule I have always gone with, but I can see your point
and could be easily swayed.

Sam




More information about the cfe-commits mailing list