diff --git a/lib/checkbufferoverrun.cpp b/lib/checkbufferoverrun.cpp index 48a527bad..cd9c71df4 100644 --- a/lib/checkbufferoverrun.cpp +++ b/lib/checkbufferoverrun.cpp @@ -818,8 +818,6 @@ void CheckBufferOverrun::checkFunctionCall(const Token *tok, const ArrayInfo &ar void CheckBufferOverrun::checkScopeForBody(const Token *tok, const ArrayInfo &arrayInfo, bool &bailout) { bailout = false; - const Token *tok2 = tok->tokAt(2); - const MathLib::bigint size = arrayInfo.num(0); // Check if there is a break in the body.. { @@ -829,6 +827,9 @@ void CheckBufferOverrun::checkScopeForBody(const Token *tok, const ArrayInfo &ar return; } + const Token *tok2 = tok->tokAt(2); + const MathLib::bigint size = arrayInfo.num(0); + std::string counter_name; unsigned int counter_varid = 0; std::string counter_init_value; @@ -951,7 +952,7 @@ void CheckBufferOverrun::checkScope(const Token *tok, const std::vector