Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions lib/token.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2182,8 +2182,6 @@ bool Token::addValue(const ValueFlow::Value &value)

// Add value
if (it == mImpl->mValues->end()) {
// If the errorPath has gotten this large then there must be something wrong
assert(value.errorPath.size() < 64);
ValueFlow::Value v(value);
if (v.varId == 0)
v.varId = mImpl->mVarId;
Expand Down
9 changes: 9 additions & 0 deletions test/testleakautovar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,15 @@ class TestLeakAutoVar : public TestFixture {
" }\n"
"};\n", /*cpp*/ true);
ASSERT_EQUALS("", errout.str());

check("int g(int *p) {\n" // #9838
" std::unique_ptr<int> temp(p);\n"
" return DoSomething(p);\n"
"}\n"
"int f() {\n"
" return g(new int(3));\n"
"}\n", /*cpp*/ true);
ASSERT_EQUALS("", errout.str());
}

void doublefree1() { // #3895
Expand Down