Description: Link cppcheck-gui with the system tinyxml
Bug: http://trac.cppcheck.net/ticket/7533

--- a/lib/checksizeof.cpp
+++ b/lib/checksizeof.cpp
@@ -32,7 +32,7 @@ namespace {
 }
 
 // CWE IDs used:
-static const struct CWE CWE398(398U);	// Indicator of Poor Code Quality
+static const struct CWE CWE398(398U);   // Indicator of Poor Code Quality
 
 //---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
diff --git a/lib/checkstl.cpp b/lib/checkstl.cpp
index b561eb2..1b18e01 100644
--- a/lib/checkstl.cpp
+++ b/lib/checkstl.cpp
@@ -28,12 +28,12 @@ namespace {
 }
 
 // CWE IDs used:
-static const struct CWE CWE398(398U);	// Indicator of Poor Code Quality
-static const struct CWE CWE597(597U);	// Use of Wrong Operator in String Comparison
-static const struct CWE CWE664(664U);	// Improper Control of a Resource Through its Lifetime
-static const struct CWE CWE704(704U);	// Incorrect Type Conversion or Cast
-static const struct CWE CWE788(788U);	// Access of Memory Location After End of Buffer
-static const struct CWE CWE834(834U);	// Excessive Iteration
+static const struct CWE CWE398(398U);   // Indicator of Poor Code Quality
+static const struct CWE CWE597(597U);   // Use of Wrong Operator in String Comparison
+static const struct CWE CWE664(664U);   // Improper Control of a Resource Through its Lifetime
+static const struct CWE CWE704(704U);   // Incorrect Type Conversion or Cast
+static const struct CWE CWE788(788U);   // Access of Memory Location After End of Buffer
+static const struct CWE CWE834(834U);   // Excessive Iteration
 
 // Error message for bad iterator usage..
 void CheckStl::invalidIteratorError(const Token *tok, const std::string &iteratorName)
diff --git a/lib/checkvaarg.cpp b/lib/checkvaarg.cpp
index c8dd172..6f82643 100644
--- a/lib/checkvaarg.cpp
+++ b/lib/checkvaarg.cpp
@@ -122,9 +122,14 @@ void CheckVaarg::va_list_usage()
                 }
                 open = nopen;
                 tok = tok->linkAt(1);
-            } else if (Token::Match(tok, "throw|return|break"))
+            } else if (Token::Match(tok, "throw|return"))
                 exitOnEndOfStatement = true;
-            else if (_tokenizer->isCPP() && tok->str() == "try") {
+            else if (tok->str() == "break") {
+                const Scope* scope = tok->scope();
+                while (scope->nestedIn && scope->type != Scope::eFor && scope->type != Scope::eWhile && scope->type != Scope::eDo && scope->type != Scope::eSwitch)
+                    scope = scope->nestedIn;
+                tok = scope->classEnd;
+            } else if (_tokenizer->isCPP() && tok->str() == "try") {
                 open = false;
                 break;
             } else if (!open && tok->varId() == var->declarationId())
diff --git a/test/testvaarg.cpp b/test/testvaarg.cpp
index eed7791..1ca9053 100644
--- a/test/testvaarg.cpp
+++ b/test/testvaarg.cpp
@@ -216,6 +216,53 @@ class TestVaarg : public TestFixture {
               "    }\n"
               "}");
         ASSERT_EQUALS("", errout.str());
+
+        // #7533
+        check("void action_push(int type, ...) {\n"
+              "    va_list args;\n"
+              "    va_start(args, type);\n"
+              "    switch (push_mode) {\n"
+              "    case UNDO:\n"
+              "        list_add(&act->node, &to_redo);\n"
+              "        break;\n"
+              "    case REDO:\n"
+              "        list_add(&act->node, &to_undo);\n"
+              "        break;\n"
+              "    }\n"
+              "    va_end(args);\n"
+              "}");
+        ASSERT_EQUALS("", errout.str());
+
+        check("void action_push(int type, ...) {\n"
+              "    va_list args;\n"
+              "    va_start(args, type);\n"
+              "    switch (push_mode) {\n"
+              "    case UNDO:\n"
+              "        list_add(&act->node, &to_redo);\n"
+              "        va_end(args);\n"
+              "        break;\n"
+              "    case REDO:\n"
+              "        list_add(&act->node, &to_undo);\n"
+              "        va_end(args);\n"
+              "        break;\n"
+              "    }\n"
+              "}");
+        ASSERT_EQUALS("", errout.str());
+
+        check("void action_push(int type, ...) {\n"
+              "    va_list args;\n"
+              "    va_start(args, type);\n"
+              "    switch (push_mode) {\n"
+              "    case UNDO:\n"
+              "        list_add(&act->node, &to_redo);\n"
+              "        break;\n"
+              "    case REDO:\n"
+              "        list_add(&act->node, &to_undo);\n"
+              "        va_end(args);\n"
+              "        break;\n"
+              "    }\n"
+              "}");
+        ASSERT_EQUALS("[test.cpp:13]: (error) va_list 'args' was opened but not closed by va_end().\n", errout.str());
     }
 
     void va_start_subsequentCalls() {
