Hi Ted,<br><br>Thanks for the info. Is there any documentation about the default checkers and non-default checkers and options to enable them?<br><br>Regards,<br>Suz<br><br><div class="gmail_quote">On Sat, Oct 15, 2011 at 12:11 AM, Ted Kremenek <span dir="ltr"><<a href="mailto:kremenek@apple.com">kremenek@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">The malloc() checker is still under development and is not on by default. Try:<br>
<br>
$ scan-build -enable-checker experimental.unix.Malloc <build line><br>
<br>
I ran it on your example and it reported:<br>
<br>
t.c:10:17: warning: Allocated memory never released. Potential memory leak.<br>
return (0);<br>
^<br>
t.c:9:9: warning: Value stored to 'p' is never read<br>
p = malloc(100);<br>
^ ~~~~~~~~~~~<br>
2 warnings generated.<br>
<div><div></div><div class="h5"><br>
On Oct 14, 2011, at 7:10 AM, Suzzane G wrote:<br>
<br>
> HI,<br>
><br>
> Here is my test program and I expected scan-build to detect resource leak.<br>
> But it is not detecting resource leak. Will you please let me know why this defect is not detected?<br>
><br>
> #include <stdio.h><br>
> #include <stdlib.h><br>
><br>
> int func (char *r)<br>
> {<br>
> int x = 0;<br>
> char *p = NULL;<br>
><br>
> p = malloc(100);<br>
> return (0);<br>
> }<br>
><br>
> Command used is "scan-build -o . --use-cc=/usr/bin/gcc-4.5 gcc -c ~/test.c"<br>
><br>
> Rgds,<br>
</div></div>> Suz _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br>
</blockquote></div><br>