<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 reported by static analyzer: "Potential memory leak""
   href="https://bugs.llvm.org/show_bug.cgi?id=33694">33694</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>False positive reported by static analyzer:  "Potential memory leak"
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>2.7
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </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>jaf@meyersound.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=18754" name="attach_18754" title="Self-contained example program that reproduces the false-positive when you compile it using scan-build">attachment 18754</a> <a href="attachment.cgi?id=18754&action=edit" title="Self-contained example program that reproduces the false-positive when you compile it using scan-build">[details]</a></span>
Self-contained example program that reproduces the false-positive when you
compile it using scan-build

Hi all,

When I run the attached trivial example program through clang's scan-build
utility, I get a warning message that I believe is a false positive:

$ scan-build g++ bogus_memory_leak_warning.cpp 
scan-build: Using '/Users/jaf/checker-279/bin/clang' for static analysis
bogus_memory_leak_warning.cpp:26:4: warning: Potential memory leak
   }
   ^
1 warning generated.
scan-build: 1 bug found.
scan-build: Run 'scan-view
/var/folders/1x/wkkcw0xx6dl54r2326vk0lh80000gn/T/scan-build-2017-07-05-132302-32588-1'
to examine bug reports.

AFAICT the code in the trivial example program doesn't have any actual memory
leaks, but SA thinks that it does.  (If I'm wrong about that, I apologize). 
Also note that if I comment out line 25 in the attached file, the
false-positive warning goes away; however I think the presence of that line
should not make any difference regarding whether the program has a memory leak
or not.

(This example application is just a minimal self-contained example, of course;
the actual codebase where I see this sort of false positive pop up is much
larger, but this example is easier to understand and debug)

-Jeremy</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>