Fixed #8036 (valueFlowUninit: strcpy(buf, e = str), free(e);)
This commit is contained in:
parent
27fb430c1e
commit
3abb62a6d1
|
@ -1680,7 +1680,7 @@ static bool valueFlowForward(Token * const startToken,
|
||||||
std::list<ValueFlow::Value>::const_iterator it;
|
std::list<ValueFlow::Value>::const_iterator it;
|
||||||
for (it = values.begin(); it != values.end(); ++it)
|
for (it = values.begin(); it != values.end(); ++it)
|
||||||
setTokenValue(tok3, *it, settings);
|
setTokenValue(tok3, *it, settings);
|
||||||
} else if (Token::Match(tok3, "++|--|?|:|;"))
|
} else if (Token::Match(tok3, "++|--|?|:|;|,"))
|
||||||
break;
|
break;
|
||||||
// Skip sizeof etc
|
// Skip sizeof etc
|
||||||
else if (Token::Match(tok3, "sizeof|typeof|typeid ("))
|
else if (Token::Match(tok3, "sizeof|typeof|typeid ("))
|
||||||
|
|
|
@ -2530,6 +2530,13 @@ private:
|
||||||
" x = dostuff(sizeof(*x)*y);\n"
|
" x = dostuff(sizeof(*x)*y);\n"
|
||||||
"}";
|
"}";
|
||||||
ASSERT_EQUALS(0U, tokenValues(code, "x )").size());
|
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());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue