[cfe-commits] unix.Malloc static checker improvement: memory.LeakPtrValChanged

Branden Archer b.m.archer4 at gmail.com
Mon Jan 7 17:51:36 PST 2013


Anna & Jordan,

I have a better idea on what is being the checkPointerEscape callback.
Thanks for your description.

The discussion below is about how we could special case it. Ex: check the
> callback to actually pass the Call parameter and use another argument to
> specify if the invalidation is direct (a pointer is an argument) or not. I
> am not sure how generic this solution is and how important it is to handle
> this.
>

I cannot think of another case where knowing if an invalidation is direct
or indirect would be important. I imagine that any checker monitoring a
function that takes a pointer to ensure that the passed pointer was valid
could make use of the information. This would beg the question of would it
be worth writing such checkers, but that would be a separate issue. The
callback could be made even more general, for example by passing an enum
that represented the type of invalidation that has occurred. However, I do
not know how much use something like that would be, especially if nothing
else may use it.

For the purpose of modifying the malloc checker to detect pointers with
non-zero offsets, would modifying the checkPointerEscape callback to pass a
boolean such as isDirectInvalidation be acceptable? There are only two
checkers using the callback currently, so making the change would not be
that extensive. I could prepare a patch with that change and another where
the free error I am interested in is detecting, and submit both for review.

- Branden
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130107/8032cabf/attachment.html>


More information about the cfe-commits mailing list