[cfe-dev] How to fix this Clang report bug?

Jordan Rose jordan_rose at apple.com
Fri Aug 2 18:12:56 PDT 2013


On Aug 2, 2013, at 4:08 , 凌欢 <linghuan713 at 126.com> wrote:

> HI, all :
> Our developers says that if set NULL to the pointer ,it can be used after released , is it right ? Following the the code which is
> reported by scan-build and the type is used after release , can anyone tell me how to fix the bug ?
> Or is it the false positive ?  please see the attathed .c file for the detail which is start line 896, end line 942.
>  Thanks all .

The false positive comes from this line:

    if(JCE_SUCCESS != ret) { return NULL; }

For some reason, we think that ret == JCE_SUCCESS when the allocation fails, but the path clearly shows JCE_MALLOC_ERROR being returned.  So now the only question is, why does the analyzer think JCE_MALLOC_ERROR and JCE_SUCCESS can be the same thing? Are they defined as "extern Int32" instead of constants?

Jordan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130802/2705f9f3/attachment.html>


More information about the cfe-dev mailing list