[PATCH][Review request] unix.Malloc checker improvement: +handling new/delete, +memory.MismatchedFree, +memory.MismatchedDelete, +improved display names for allocators/deallocators

Anna Zaks ganna at apple.com
Thu Mar 7 17:08:48 PST 2013


On Mar 7, 2013, at 3:53 PM, Anton Yartsev <anton.yartsev at gmail.com> wrote:

> On 07.03.2013 21:29, Jordan Rose wrote:
>> On Mar 7, 2013, at 4:47 , Anton Yartsev <anton.yartsev at gmail.com> wrote:
>> 
>>> On 06.03.2013 21:46, Anna Zaks wrote:
>>>> CC-ing the patch author!
>>>> 
>>>> Also,
>>>> 
>>>> Could you split out the ObjC NoCopy + FreeWhenDone change into a separate patch. It does not seem to be directly related to the other changes. Also, I am not 100% sure what changes we are making there. One part is refactoring, however, you've also removed the check for the message calls from the doesNotFreeMemory(). Do we expect any behavior changes from this?
>>>> (Sorry if I've missed something; the patch is getting big.)
>>> Splitted ObjC NoCopy + FreeWhenDone change, kept changes in doesNotFreeMemory().
>>> The logic of doesNotFreeMemory() was broken - it treated all 'NoCopy' and 'FreeWhenDone==1' methods as freeing memory and unknown to us. This lead to removal of RefState from the State and impossibility for further alloc/dealloc matching analysis.
>> Can we just do the Objective-C part first? Can you send that patch too?
> Attached. I'll update the main patch after this one gets in.
> 

This has a functionality change (as Anton mentioned in one of the previous emails). It's an enhancement - we are now tracking the object after it's been freed with the NoCopy functions. As such, the patch needs a test case. I think you should be able to test for double free here.

Anna.
>>> Have not found any suitable place in lib/Frontend/CompilerInvocation.cpp
>>> Did you mean to update clang/lib/Driver/Tools.cpp ?
>> Whoops, I grepped for "unix" and found the comment there. You're right, and that's the right change.
> 
> -- 
> Anton
> 
> <MallocCheckerRefactoring.patch>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130307/a8b332cb/attachment.html>


More information about the cfe-commits mailing list