Fixed #8036 (valueFlowUninit: strcpy(buf, e = str), free(e);)

This commit is contained in:
Daniel Marjamäki 2017-08-20 19:47:26 +02:00
parent 27fb430c1e
commit 3abb62a6d1
2 changed files with 8 additions and 1 deletions

View File

@ -1680,7 +1680,7 @@ static bool valueFlowForward(Token * const startToken,
std::list<ValueFlow::Value>::const_iterator it;
for (it = values.begin(); it != values.end(); ++it)
setTokenValue(tok3, *it, settings);
} else if (Token::Match(tok3, "++|--|?|:|;"))
} else if (Token::Match(tok3, "++|--|?|:|;|,"))
break;
// Skip sizeof etc
else if (Token::Match(tok3, "sizeof|typeof|typeid ("))

View File

@ -2530,6 +2530,13 @@ private:
" x = dostuff(sizeof(*x)*y);\n"
"}";
ASSERT_EQUALS(0U, tokenValues(code, "x )").size());
// #8036
code = "void foo() {\n"
" int x;\n"
" f(x=3), return x+3;\n"
"}";
ASSERT_EQUALS(0U, tokenValues(code, "x +").size());
}
};