<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Right, then. You've never actually told the analyzer that JCE_SUCCESS and JCE_MALLOC_ERROR are distinct constants, so it's not going to be able to do a good job here. You can either make the definitions of the constants visible, or put them in an enum (same basic idea). (In theory you could assert that they are different, but the analyzer doesn't track relationships between independent symbolic values. Besides, you'd have to assert that in every function.)</div><div><br></div><div>Sorry for the inconvenience,</div><div>Jordan</div><div><br></div><br><div><div>On Aug 6, 2013, at 2:25 , 凌欢 <<a href="mailto:linghuan713@126.com">linghuan713@126.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="line-height: 1.7; font-size: 14px; font-family: arial; "><div><br>It is defined extern const Int 32.<br><br> BRs</div><div>
<div>Howard Ling </div>
<div>*****************************************************</div>
<div> </div>
<div>E-mail: <a href="mailto:linghuan713@126.com">linghuan713@126.com</a></div>
<div> </div>
<div>*****************************************************</div></div><div id="divNeteaseMailCard"></div><div></div>在 2013-08-03 09:12:56,"Jordan Rose" <<a href="mailto:jordan_rose@apple.com">jordan_rose@apple.com</a>> 写道:<br> <blockquote style="margin: 0px 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 1px; border-left-style: solid;" id="isReplyContent"><br><div><div>On Aug 2, 2013, at 4:08 , 凌欢 <<a href="mailto:linghuan713@126.com">linghuan713@126.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="line-height: 1.7; font-family: arial; font-size: 14px;"><div>HI, all :</div><div>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 </div><div>reported by scan-build and the type is used after release , <strong>can anyone tell me how to fix the bug ?</strong></div><div><strong>Or is it the false positive ? </strong> please see the attathed .c file for the detail which is start line 896, end line 942.</div><div> Thanks all . </div></div></blockquote></div><br><div>The false positive comes from this line:</div><div><br></div><div><table style="width: 3446px; line-height: 1.2em; font-family: monospace, monospace; font-size: 13px; border-collapse: collapse; " class="code"><tbody><tr><td style="padding-left: 1ex; border-left-color: rgb(204, 204, 204); border-left-width: 3px; border-left-style: solid; white-space: pre;" class="line"> <span style="color: blue;" class="keyword">if</span>(JCE_SUCCESS != ret) { <span style="color: blue;" class="keyword">return</span> <span style="color: rgb(139, 0, 139); position: relative; background-color: rgb(255, 250, 205);" class="macro">NULL</span>; }</td></tr><tr></tr></tbody></table><br></div><div>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?</div><div><br></div><div>Jordan</div></blockquote></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span></blockquote></div><br></body></html>