<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - False positive: memory leak reported for cast to union"
href="https://llvm.org/bugs/show_bug.cgi?id=25701">25701</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>False positive: memory leak reported for cast to union
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Static Analyzer
</td>
</tr>
<tr>
<th>Assignee</th>
<td>kremenek@apple.com
</td>
</tr>
<tr>
<th>Reporter</th>
<td>warren@icouldbedeadwrong.net
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=15378" name="attach_15378" title="Test case">attachment 15378</a> <a href="attachment.cgi?id=15378&action=edit" title="Test case">[details]</a></span>
Test case
Platform: Ubuntu 14.04.2 LTS
Tool version (svn info):
URL: <a href="http://llvm.org/svn/llvm-project/cfe/trunk/tools/scan-build">http://llvm.org/svn/llvm-project/cfe/trunk/tools/scan-build</a>
Relative URL: ^/cfe/trunk/tools/scan-build
Repository Root: <a href="http://llvm.org/svn/llvm-project">http://llvm.org/svn/llvm-project</a>
Repository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8
Revision: 254388
I have written a small test case (see attachment) - this code compiles and
passes through valgrind without issue. However, scan-build complains about a
possible memory leak, as follows:
/opt/llvm/libexec/ccc-analyzer -o union -g -Wall -Wextra union.c
union.c:25:5: warning: Potential leak of memory pointed to by 'ret'
return (request_un)ret;
^~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
(Note that the memory in question is freed on line 42).</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>