[cfe-commits] [PATCH 1/1] Checking zero byte allocation for realloc() and calloc().

Jordy Rose jediknil at belkadan.com
Sat Nov 26 22:42:19 PST 2011


On Nov 27, 2011, at 13:26, Ted Kremenek wrote:

> Here's what I think we should do.  I think we should put this checking logic into both UnixAPIChecker and MallocChecker.  When MallocChecker is enabled by default, we remove this logic from UnixAPIChecker.  We could possibly enhance UnixAPIChecker to check if the MallocChecker is enabled, and if so, not warn about these cases (avoiding duplicate checking).
> 
> Cyril/Jordy: what do you think?
> 
> Cheers,
> Ted

Sorry for throwing you in the wrong direction, Cyril. I knew there was a reason for the current split between UnixAPIChecker and MallocChecker, but I forgot what it was. And this certainly is a check that can be enabled now safely, and doesn't cost much to check.

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 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.

Jordy



More information about the cfe-commits mailing list