diff --git a/Applications/FileIO/CsvInterface.cpp b/Applications/FileIO/CsvInterface.cpp
index 5536da166ab3cdde78092fe05a639c4cdc439797..19636a82ee6f36f3e69cc6578ddc65163a3712ff 100644
--- a/Applications/FileIO/CsvInterface.cpp
+++ b/Applications/FileIO/CsvInterface.cpp
@@ -201,11 +201,11 @@ int CsvInterface::readPoints(std::ifstream& in, char delim,
             continue;
         }
 
-        std::array<double, 3> point{};
         it = fields.begin();
         try
         {
             std::advance(it, column_advance[0]);
+            std::array<double, 3> point{};
             point[order[0]] = std::stod(*it);
             std::advance(it, column_advance[1]);
             point[order[1]] = std::stod(*it);
diff --git a/Applications/FileIO/TetGenInterface.cpp b/Applications/FileIO/TetGenInterface.cpp
index aef1f947b3a197f7265cd48f346b1c509a4324c9..4d94dff7e1f0a08f34da4815a6a85fe47ae0cff8 100644
--- a/Applications/FileIO/TetGenInterface.cpp
+++ b/Applications/FileIO/TetGenInterface.cpp
@@ -161,11 +161,11 @@ bool TetGenInterface::parseSmeshFacets(
                 "meshes.");
             return false;
         }
-        std::vector<std::size_t> point_ids;
         const std::size_t point_field_size =
             (_boundary_markers) ? nPoints + 1 : nPoints;
         if (point_fields.size() > point_field_size)
         {
+            std::vector<std::size_t> point_ids;
             for (std::size_t j(0); j < nPoints; ++j)
             {
                 point_ids.push_back(
diff --git a/MeshLib/IO/Legacy/MeshIO.cpp b/MeshLib/IO/Legacy/MeshIO.cpp
index 3ab255bf7f8b9fb7bf109fde2d1bf88161315baf..3eb1c38874cbff667f62a576eca39afc01fbb273 100644
--- a/MeshLib/IO/Legacy/MeshIO.cpp
+++ b/MeshLib/IO/Legacy/MeshIO.cpp
@@ -54,12 +54,12 @@ MeshLib::Mesh* MeshIO::loadMeshFromFile(const std::string& file_name)
     std::string line_string;
     getline(in, line_string);
 
-    std::vector<MeshLib::Node*> nodes;
-    std::vector<MeshLib::Element*> elements;
-    std::vector<std::size_t> materials;
-
     if (line_string.find("#FEM_MSH") != std::string::npos)  // OGS mesh file
     {
+        std::vector<MeshLib::Node*> nodes;
+        std::vector<MeshLib::Element*> elements;
+        std::vector<std::size_t> materials;
+
         while (!in.eof())
         {
             getline(in, line_string);
diff --git a/ProcessLib/ComponentTransport/LookupTable.cpp b/ProcessLib/ComponentTransport/LookupTable.cpp
index 5e3c749ab0d57264a5f5f683cefb6ad1a835fc39..8ef571979ac9cb96a3dbea6fc31e8ab3b7acecc3 100644
--- a/ProcessLib/ComponentTransport/LookupTable.cpp
+++ b/ProcessLib/ComponentTransport/LookupTable.cpp
@@ -134,8 +134,6 @@ void LookupTable::lookup(std::vector<GlobalVector*> const& x,
 std::size_t LookupTable::getTableEntryID(
     std::vector<double> const& entry_input) const
 {
-    std::vector<std::size_t> temp_vec;
-
     std::vector<std::size_t> intersected_vec =
         /// point_id_groups stores indices where the elements equal to the given
         /// value.
@@ -151,10 +149,9 @@ std::size_t LookupTable::getTableEntryID(
             input_fields[i].point_id_groups[BaseLib::findIndex(
                 input_fields[i].seed_points, entry_input[i])];
 
-        temp_vec = intersection(intersected_vec, vec);
+        auto temp_vec = intersection(intersected_vec, vec);
 
         std::swap(intersected_vec, temp_vec);
-        temp_vec.clear();
     }
 
     return intersected_vec[0];