[LLVMbugs] [Bug 19102] New: alpha.cplusplus.NewDeleteLeaks false-positive: unassigned dynamically created object

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Mar 10 17:36:05 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19102

            Bug ID: 19102
           Summary: alpha.cplusplus.NewDeleteLeaks false-positive:
                    unassigned dynamically created object
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: anton.yartsev at Gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Test illustrating the leak:

class B;

class A {
  B* b;
public:
  A() : b(0) {}; 
  ~A();
  void SetB(B* bb) {
    b = bb;
  }
};

class B {
public:
  B(A& a) {
    a.SetB(this);
  }
};

A::~A() {
  if (b)
    delete b;
}

void f() {
  A a;
  new B(a);
} <----- false-positive leak report; Memory is freed inside ~A();

The following trick is common for LLVM/lib/Target/* and LLVM/lib/MC/*.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140311/e97a3127/attachment.html>


More information about the llvm-bugs mailing list