parent
036df0aca9
commit
d7c7a39afe
|
@ -1109,8 +1109,8 @@ void CheckLeakAutoVar::ret(const Token *tok, VarInfo &varInfo, const bool isEndO
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't warn when returning after checking return value of outparam allocation
|
// don't warn when returning after checking return value of outparam allocation
|
||||||
const Scope* scope = tok->scope();
|
if (it->second.allocTok && (tok->scope()->type == Scope::ScopeType::eIf || tok->scope()->type== Scope::ScopeType::eElse)) {
|
||||||
if (scope->type == Scope::ScopeType::eIf || scope->type== Scope::ScopeType::eElse) {
|
const Scope* scope = tok->scope();
|
||||||
if (scope->type == Scope::ScopeType::eElse) {
|
if (scope->type == Scope::ScopeType::eElse) {
|
||||||
scope = scope->bodyStart->tokAt(-2)->scope();
|
scope = scope->bodyStart->tokAt(-2)->scope();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1594,6 +1594,16 @@ private:
|
||||||
" s->p = NULL;\n"
|
" s->p = NULL;\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
const Settings s = settingsBuilder().library("std.cfg").build();
|
||||||
|
check("struct S {};\n"
|
||||||
|
"void f(int i, std::vector<std::unique_ptr<S>> &v) {\n"
|
||||||
|
" if (i < 1) {\n"
|
||||||
|
" auto s = new S;\n"
|
||||||
|
" v.push_back(std::unique_ptr<S>(s));\n"
|
||||||
|
" }\n"
|
||||||
|
"}\n", &s);
|
||||||
|
ASSERT_EQUALS("", errout.str()); // don't crash
|
||||||
}
|
}
|
||||||
|
|
||||||
void goto1() {
|
void goto1() {
|
||||||
|
|
Loading…
Reference in New Issue