Hi, I use cppcheck-2.13.0 to check the following code
#include <list> using namespace std; struct C{ char* m_p; C(char* p) : m_p(p){} }; int main(){ std::list<C> li; char* p = new char[1]; C c(p); li.push_back(c); C c2(li.front()); delete [] c2.m_p; }
, and get
CWE: 401 Memory leak: p
but I think the memery assigned to p (char* p = new char[1]) is deleted by "delete [] c2.m_p". Is this a false positive?
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/12327
Log in to post a comment.
Hi,
I use cppcheck-2.13.0 to check the following code
, and get
CWE: 401
Memory leak: p
but I think the memery assigned to p (char* p = new char[1])
is deleted by "delete [] c2.m_p".
Is this a false positive?
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/12327