<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 - Analyzer: "Attempt to delete released memory" for calls to unique_ptr::Reset()"
   href="https://bugs.llvm.org/show_bug.cgi?id=32233">32233</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Analyzer: "Attempt to delete released memory" for calls to unique_ptr::Reset()
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>enhancement
          </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>marshallk@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>This error seems noisy, as unique_ptr ownership should provide ordering
guarantees against multiple deletion.

LLVM version: clang version 5.0.0 (trunk 296321)
Platform: Linux; target: Linux
Code:
<a href="https://cs.chromium.org/chromium/src/extensions/browser/value_store/lazy_leveldb.cc">https://cs.chromium.org/chromium/src/extensions/browser/value_store/lazy_leveldb.cc</a>

../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/unique_ptr.h:63:9:
warning: Attempt to delete released memory
        delete __ptr;
               ^
../../extensions/browser/value_store/lazy_leveldb.cc:101:3: note: Taking false
branch
  if (s.IsNotFound()) {
  ^
../../extensions/browser/value_store/lazy_leveldb.cc:107:3: note: Taking false
branch
  if (!s.ok())
  ^
../../extensions/browser/value_store/lazy_leveldb.cc:112:3: note: Taking true
branch
  if (!val)
  ^
../../extensions/browser/value_store/lazy_leveldb.cc:113:55: note: Calling
'LazyLevelDb::FixCorruption'
    return ValueStore::Status(ValueStore::CORRUPTION, FixCorruption(&key),
                                                      ^~~~~~~~~~~~~~~~~~~
../../extensions/browser/value_store/lazy_leveldb.cc:159:7: note: Left side of
'&&' is true
  if (key && db_) {
      ^
../../extensions/browser/value_store/lazy_leveldb.cc:159:3: note: Taking true
branch
  if (key && db_) {
  ^
../../extensions/browser/value_store/lazy_leveldb.cc:163:5: note: Taking false
branch
    if (s.ok())
    ^
../../extensions/browser/value_store/lazy_leveldb.cc:165:10: note: Taking false
branch
    else if (s.IsIOError())
         ^
../../extensions/browser/value_store/lazy_leveldb.cc:185:3: note: Taking true
branch
  if (s.ok()) {
  ^
../../extensions/browser/value_store/lazy_leveldb.cc:190:3: note: Taking false
branch
  if (!s.ok()) {
  ^
../../extensions/browser/value_store/lazy_leveldb.cc:199:3: note: Taking true
branch
  if (s.ok())
  ^
../../extensions/browser/value_store/lazy_leveldb.cc:204:7: note: Left side of
'&&' is true
  if (s.ok() && key) {
      ^
../../extensions/browser/value_store/lazy_leveldb.cc:204:3: note: Taking true
branch
  if (s.ok() && key) {
  ^
../../extensions/browser/value_store/lazy_leveldb.cc:206:5: note: Taking false
branch
    if (s.ok()) {
    ^
../../extensions/browser/value_store/lazy_leveldb.cc:208:12: note: Taking false
branch
    } else if (s.IsIOError()) {
           ^
../../extensions/browser/value_store/lazy_leveldb.cc:211:7: note: Calling
'unique_ptr::reset'
      db_.reset(db);
      ^~~~~~~~~~~~~
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/unique_ptr.h:244:2:
note: Taking true branch
        if (__p != pointer())
        ^
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/unique_ptr.h:245:4:
note: Calling 'default_delete::operator()'
          get_deleter()(__p);
          ^~~~~~~~~~~~~~~~~~
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/unique_ptr.h:63:2:
note: Memory is released
        delete __ptr;
        ^~~~~~~~~~~~
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/unique_ptr.h:245:4:
note: Returning; memory was released via 2nd parameter
          get_deleter()(__p);
          ^~~~~~~~~~~~~~~~~~
../../extensions/browser/value_store/lazy_leveldb.cc:211:7: note: Returning;
memory was released via 1st parameter
      db_.reset(db);
      ^~~~~~~~~~~~~
../../extensions/browser/value_store/lazy_leveldb.cc:212:12: note: Calling
'LazyLevelDb::DeleteDbFile'
      if (!DeleteDbFile())
           ^~~~~~~~~~~~~~
../../extensions/browser/value_store/lazy_leveldb.cc:269:3: note: Calling
'unique_ptr::reset'
  db_.reset();  // release any lock on the directory
  ^~~~~~~~~~~
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/unique_ptr.h:244:2:
note: Taking true branch
        if (__p != pointer())
        ^
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/unique_ptr.h:245:4:
note: Calling 'default_delete::operator()'
          get_deleter()(__p);
          ^~~~~~~~~~~~~~~~~~
../../build/linux/debian_wheezy_amd64-sysroot/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/bits/unique_ptr.h:63:9:
note: Attempt to delete released memory
        delete __ptr;</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>