<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Aug 2, 2013, at 10:16 AM, Bernd Schubert <<a href="mailto:bernd.schubert@itwm.fraunhofer.de">bernd.schubert@itwm.fraunhofer.de</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Thanks Anna,<br><br>and sorry, it was just some pseudo code I quickly wrote down. Hmm,<br>indeed it does report it, but it didn't for the actual code I was using.<br>Ah, the actual code has foo() in a different file. Is it possible to use<br>the analyzer with link time optimization?<br><br></div></blockquote><br>That must be it. The analyzer can only "see" functions which have definitions in the same translation unit - same source file or one of the included headers.</div><div><br><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Thanks,<br>Bernd<br><br>On 08/02/2013 07:04 PM, Anna Zaks wrote:<br><blockquote type="cite">Bernd,<br><br>The latest analyzer should warn about double frees.<br><br>The code you provided does not compile, but the analyzer warns on this<br>fixed code snippet:<br>class my_object_t {};<br>void foo(my_object_t *obj) {<br>delete obj;<br>}<br>int foo2() {<br>my_object_t *obj = new my_object_t;<br>if (!obj)<br>return -1;<br>foo(obj);<br>delete obj;<br>}<br><br>*/Users/zaks/tmp/ex.cpp:10:2: **warning: **Attempt to free released memory*<br> delete obj;<br><br>Cheers,<br>Anna.<br>On Aug 2, 2013, at 5:09 AM, Bernd Schubert<br><<a href="mailto:bernd.schubert@itwm.fraunhofer.de">bernd.schubert@itwm.fraunhofer.de</a><br><<a href="mailto:bernd.schubert@itwm.fraunhofer.de">mailto:bernd.schubert@itwm.fraunhofer.de</a>>> wrote:<br><br><blockquote type="cite">Hi all,<br><br>is there some way to instruct the static analyzer to check for double<br>deleted objects?<br><br><br>void foo(my_object_t obj)<br>{<br>delete obj;<br>}<br><br>main()<br>{<br>my_object_t *obj = new my_object_t;<br><br>if (!obj)<br>return -1;<br><br>foo(obj);<br><br>delete obj;<br>}<br><br><br>I just found something like that in my code and the static analyzer<br>hadn't detected it.<br><br><br>Thanks,<br>Bernd<br><br>_______________________________________________<br>cfe-users mailing list<br><a href="mailto:cfe-users@cs.uiuc.edu">cfe-users@cs.uiuc.edu</a><span class="Apple-converted-space"> </span><<a href="mailto:cfe-users@cs.uiuc.edu">mailto:cfe-users@cs.uiuc.edu</a>><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users</a></blockquote></blockquote></div></blockquote></div><br></body></html>