[cfe-commits] [PATCH 1/1] Checking zero byte allocation for realloc() and calloc().
kremenek at apple.com
Sun Nov 27 07:32:15 PST 2011
On Nov 26, 2011, at 10:42 PM, Jordy Rose wrote:
> I don't like the idea of having duplicated code, or even shared code between MallocChecker and UnixAPIChecker. The two checkers really shouldn't know about each other, and in practical use I think it's rare for people to run the analyzer with MallocChecker enabled and UnixAPIChecker disabled.
I completely agree. This situation is not ideal.
> I guess, even though there's duplicated work /now/, I'd leave it the original way. And maybe eventually we'll have a way to enable or disable certain checks in a checker, right? Then we can move the logic to MallocChecker where it belongs, even if we don't have IPA yet.
Yes, that would be a good option. Conceptually these two checkers are doing different checks. UnixAPIChecker is checking function preconditions, while MallocChecker is checking allocation typestate. The precondition checks for malloc() and friends should ideally be in MallocChecker, but we should have the ability to selectively enable parts of that checker (where it makes sense).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-commits